SUMMARY:Customize Solaris 2.5 Cdrom

From: Lau, Victoria H (vlau@msmail2.hac.com)
Date: Fri Apr 05 1996 - 20:37:25 CST


It has been a number of months since I posted a help request on customizing
the Solaris 2.X cdrom. Since then I had requested help on changing the
cdrom label checksum which was related to this task. I finally had completed
my first version of customized cdrom a couple of days ago. The enclosed
log file displays the actual commands and sequence of events I went through
in creating a cdrom that fits our purpose. For those who are not interested
in browsing through a quite lengthy report, I'll summarize the steps below.

But first, I'd like to thank the following Sun-Managers who kindly responded
to my request and had given me some good advise, especially Jason Liao who
suggested an alternate GEAR support in Europe, elektro@sci.kun.nl. Even
though the GEAR tech support could not help me to complete the task, they'd
given me plenty of info to do the job.

  Kevin Sheehan
  Jason Liao
  Celeste Stokely
  Thom Garrett

My original question was also very lengthy. To make it short: I was trying
to create my own customized Solaris 2.X cdrom to load a master system onto
all nodes when "boot cdrom" is issued at the monitor prompt. I'm using a
SunSystem 600 running Solaris 2.5, GEAR software, and Pinnacle Micro Model
RCD-1000 cdrom cutter. Please note that the solution is ONLY for Solaris
2.5. To customize Solaris 2.4 and earlier version, check the .slicemap
file in s0 and customize the slice for your platform (e.g., sun4m is s3)
instead of s1.

Summarized steps of one solution:
================================
- kill vold
- dd s0 (hsfs) from cdrom (this includes the 2k disk label)
- dd s1 thru s5 to disk
- restart vold
- dd s1 to a raw partition
- mount s1
- add version number to s1 (version_1.0)
- edit s1:/sbin/startup, add restore_sd0 to s1:/sbin
- umount s1
- dd s1 raw partition to file s1
- concatenate s0 through s5 into a file
- use GEAR to write this file as a foreign image to a new cd

=============================================================================
I originally planned to write a new format.dat to s0 as I need to add
the 2.4GB, 4.3GB, and 9.1GB structures into this file. If anyone could
give me some good lead on this, I'm willing and ready to recustomize
my cdrom. I could use the GEAR software to write s0 into a virtual volume,
add/delete/replace files, and output this customized image to a GEAR physical
volume. However, the size of this volume is always bigger than the original
s0, even without making any changes (GEAR must have added some overhead to
the file). I attempted to change the total cylinder size for s0 in the disk
label but when I booted with this cdrom, I got a disk label checksum error.

For those who are interested, I'm detailing my FAILED attempt here:

- kill vold
- dd first 2K bytes from the original cdrom (label) to disk
- dd s0 (hsfs) from cdrom (for size comparison purposes only)
- dd s1 thru s5 to disk
- restart vold
- use GEAR to create a virtual image of /cdrom/cdrom0/s0
- remove some patches from the virtual image (hoping that I could use this
  same space for my files)
- add format.dat to s0
- use GEAR to create a physical image of s0 from the virtual image
- Use dd to elete the GEAR physical image boot label by deleting the first 2K
  bytes from the file
- the output of the physical image is always bigger than the original s0.
  (The output file size remains the same even after I removed some files from
  the virtual image)
- >>> I USED beav BINARY EDITOR TO CHANGE THE TOTAL SECTOR SIZE
      OF s0 BUT I DON'T KNOW HOW TO HANDLE THE BOOT LABEL CHECKSUM. IF
      CHECKSUM RESIDES IN "DA BE AE E1" (1F4), HOW DO I CHANGE THE
      CHECKSUM TO ACCOMMODATE THE ADDED SIZE ON s0 <<<
>>> I'm attaching the label at the end of this summary <<<
- dd s1 to a raw partition
- mount s1
- add version number to s1 (version_1.0)
- edit s1:/sbin/startup, add restore_sd0 to s1:/sbin
- umount s1
- dd s1 raw partition to file s1
- concatenate all files into one file: disk label from original cdrom, GEAR
  physical image, revised s1, s2, s3, s4, and s5
- Use GEAR to write a foreign image onto a new cd

================================================================================
The following shows my attempt to change the disk label sector size for s0 to
a bigger size. When I used this label to generate a new cd, the error I got
was CHECKSUM on the disk label.
================================================================================

===============================================================================
The output of s0 is larger than the original s0. Use beav editor to
change the sector size of s0 from 641280 (0x09c900) to 647168 (0x09E000).
===============================================================================

tstm# /h/beav/beav boot_label
          0: 43 44 2D 52 4F 4D 20 44 69 73 63 20 66 6F 72 20 CD-ROM Disc for
         10: 53 75 6E 4F 53 20 53 6F 6C 61 72 69 73 5F 32 2E SunOS
Solaris_2.
         20: 35 20 49 6E 73 74 61 6C 6C 61 74 69 6F 6E 20 20 5 Installation
         30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         80: 00 00 00 01 00 00 00 00 00 00 00 00 00 08 00 04
................
         90: 00 10 00 02 00 10 00 02 00 10 00 02 00 10 00 02
................
         A0: 00 10 00 02 00 10 00 00 00 00 00 00 00 00 00 00
................
         B0: 00 00 00 00 00 00 00 00 00 00 00 00 60 0D DE EE
............`...
         C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
         F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        1A0: 00 00 00 00 01 5E 08 00 00 00 00 00 00 00 00 01
.....^..........
        1B0: 08 00 00 00 00 01 02 80 00 00 00 00 00 00 00 00
................
        1C0: 00 09 C9 00 00 00 03 EA 00 01 47 80 00 00 04 6D
..........G....m
        1D0: 00 00 0A 00 00 00 04 71 00 00 0A 00 00 00 04 75
.......q.......u
        1E0: 00 00 0A 00 00 00 04 79 00 00 0A 00 00 00 00 00
.......y........
        1F0: 00 00 00 00 00 00 00 00 00 00 00 00 DA BE AE E1
................
        200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
        280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
 
 
 
===============================================================================
Comments on changes:

1C0: 00 09 c9 00 (641280 -- sector count for s0)
     00 00 03 EA (1002) >>>WHAT IS THIS NUMBER???<<<
 
1C4: 00 01 47 80 (83840 -- sector count for s1)
     00 00 04 6D (1133)
 
1D0: 00 00 0A 00 (2560 -- sector count for s2)
     00 00 04 71 (1137)
 
1D4: 00 00 0A 00 (2560 -- sector count for s3)
     00 00 04 75 (1141)
 
1E0: 00 00 0A 00 (2560 -- sector count for s4)
     00 00 04 79 (1145)
 
1E4: 00 00 0A 00 (2560 -- sector count for s5)
     00 00 00 00 (0)
 
1F0: 00 00 00 00
     00 00 00 00
 
1F4: 00 00 00 00
     DA BE AE E1 (3669929697) >>>IS THIS THE CHECKSUM? HOW TO CALCULATE THE
                                 NEW CHECKSUM?<<<
 
 
 
 
tstm# bc
1133-1002
131
1137-1133
4
1141-1137
4
1145-1141
4
^D
 
 
 
Change s0 to size 331350016:
 
  331350016/512 = 647168 (DEC)
 
  647168 (DEC) = 0x09E000
 
 
Change 1C0 line as follows:
  1C0: 00 09 E0 00 00 00 03 EA
 
===============================================================================

I WELCOME any comments and criticism, with the purpose of producing a fool
proof customized boot cdrom. We are contemplating testing out the Young
Minds solution. I'm sure I'll need help from you again then.

Thank you.

Vicky Lau
vlau@msmail2.hac.com

<<<<<< Attached TEXT file named "sol2.5_cus.log" follows >>>>>>
===============================================================================
This is a log file to customize the Solaris 2.5 boot cdrom.

Edit s1:/sbin/startup to run s1:/sbin/restore_sd0, then exit the startup
script. Copy restore_sd0 to s1:/sbin directory. This script downloads the
latest format.dat (with 2.4 and 9.1 GB of format/partitioning instructions)
from an 8mm tape, and places it in /tmp/root/etc directory, labels/relabels
and repartitions the system disk, newfs's system disk file systems, restores
file systems from the same 8mm tape, writes a bootblk to /dev/rdsk/c0t3d0s0,
and reboots system with reconfigure boot.

The working directory must be over 1GB in size.

CDR software and hardware:
  GEAR software (Elektroson) v3.24 or above
  Pinnacle Mirco RCD-1000

Summarized steps:
================
- kill vold
- dd s0 (hsfs) from cdrom (this includes the 2k disk label)
- dd s1 thru s5 to disk
- restart vold
- dd s1 to a raw partition
- mount s1
- add version number to s1 (version_1.0)
- edit s1:/sbin/startup, add restore_sd0 to s1:/sbin
- umount s1
- dd s1 raw partition to file s1
- concatenate s0 through s5 into a file
- use GEAR to write this file as a foreign image to a new cd

The "mkbit_sol" script to create the system dumps is listed at the end of
the log file. Be sure to place the new version of format.dat in the same
directory where the scrript is run.
===============================================================================

===============================================================================
Check the total cdrom file system sizes.
===============================================================================

tstm# df -k
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t3d0s0 90282 18367 62895 23% /
/dev/dsk/c0t3d0s6 217618 166951 28907 85% /usr
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
/dev/dsk/c0t3d0s7 571088 204484 309504 40% /h
/dev/dsk/c0t3d0s3 432945 165652 224003 43% /tmp_opt_SECURITY
/dev/dsk/c0t3d0s5 240770 9 216691 0% /second
/dev/dsk/c0t3d0s4 335687 9 302118 0% /unused
/vol/dev/dsk/c0t6/solaris_2_5_sparc/s5
                         502 12 450 3%
/cdrom/solaris_2_5_sparc/s5
/vol/dev/dsk/c0t6/solaris_2_5_sparc/s4
                         502 12 450 3%
/cdrom/solaris_2_5_sparc/s4
/vol/dev/dsk/c0t6/solaris_2_5_sparc/s3
                         502 12 450 3%
/cdrom/solaris_2_5_sparc/s3
/vol/dev/dsk/c0t6/solaris_2_5_sparc/s2
                         502 12 450 3%
/cdrom/solaris_2_5_sparc/s2
/vol/dev/dsk/c0t6/solaris_2_5_sparc/s1
                       38886 22192 12814 63%
/cdrom/solaris_2_5_sparc/s1
/vol/dev/dsk/c0t6/solaris_2_5_sparc/s0
                      320530 -1 -1 100%
/cdrom/solaris_2_5_sparc/s0

================================================================================
Create a partition larger than two times of the sum of all the cdrom file
systems. We also need another partition of over 40 MB to edit the s1 file
system.
================================================================================

tstm# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t3d0 <Seagate Elite ST42400N cyl 2700 alt 2 hd 19 sec 81>
          /iommu@f,e0000000/sbus@f,e0001000/dma@f,81000/esp@f,80000/sd@3,0
       1. c1t0d0 <SEAGATE-ST42400N-0111 cyl 2604 alt 2 hd 19 sec 84>
          /iommu@f,e0000000/sbus@f,e0001000/dma@3,81000/esp@3,80000/sd@0,0
       2. c1t3d0 <SEAGATE-ST42400N-0111 cyl 2604 alt 2 hd 19 sec 84>
          /iommu@f,e0000000/sbus@f,e0001000/dma@3,81000/esp@3,80000/sd@3,0
Specify disk (enter its number): 1
selecting c1t0d0
[disk formatted]

FORMAT MENU:
        disk - select a disk
        type - select (define) a disk type
        partition - select (define) a partition table
        current - describe the current disk
        format - format and analyze the disk
        repair - repair a defective sector
        label - write label to the disk
        analyze - surface analysis
        defect - defect list management
        backup - search for backup labels
        verify - read and display labels
        save - save new disk/partition definitions
        inquiry - show vendor, product and revision
        volname - set 8-character volume name
        quit
format> p
 
 
PARTITION MENU:
        0 - change `0' partition
        1 - change `1' partition
        2 - change `2' partition
        3 - change `3' partition
        4 - change `4' partition
        5 - change `5' partition
        6 - change `6' partition
        7 - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name - name the current table
        print - display the current table
        label - write partition map and label to the disk
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 2604 + 2 (reserved cylinders)
 
Part Tag Flag Cylinders Size Blocks
  0 root wm 0 - 461 360.04MB (462/0/0)
  1 swap wu 462 - 482 16.37MB (21/0/0)
  2 backup wu 0 - 2603 1.98GB (2604/0/0)
  3 unassigned wm 483 - 503 16.37MB (21/0/0)
  4 unassigned wm 504 - 524 16.37MB (21/0/0)
  5 unassigned wm 525 - 545 16.37MB (21/0/0)
  6 usr wm 546 - 566 16.37MB (21/0/0)
  7 unassigned wm 567 - 1080 400.56MB (514/0/0)
 
partition> q
 
 
FORMAT MENU:
        disk - select a disk
        type - select (define) a disk type
        partition - select (define) a partition table
        current - describe the current disk
        format - format and analyze the disk
        repair - repair a defective sector
        label - write label to the disk
        analyze - surface analysis
        defect - defect list management
        backup - search for backup labels
        verify - read and display labels
        save - save new disk/partition definitions
        inquiry - show vendor, product and revision
        volname - set 8-character volume name
        quit
format> q
 

 
tstm# newfs /dev/rdsk/c1t0d0s2
newfs: /dev/rdsk/c1t0d0s2 last mounted as
newfs: construct a new file system /dev/rdsk/c1t0d0s2: (y/n)? y
/dev/rdsk/c1t0d0s2: 4155984 sectors in 2604 cylinders of 19 tracks, 84
sectors
        2029.3MB in 163 cyl groups (16 c/g, 12.47MB/g, 6016 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 25664, 51296, 76928, 102560, 128192, 153824, 179456, 205088, 230720,
 256352, 281984, 307616, 333248, 358880, 384512, 410144, 435776, 461408,
 487040, 512672, 538304, 563936, 589568, 615200, 640832, 666464, 692096,
 717728, 743360, 768992, 794624, 817184, 842816, 868448, 894080, 919712,
 945344, 970976, 996608, 1022240, 1047872, 1073504, 1099136, 1124768, 1150400,
 1176032, 1201664, 1227296, 1252928, 1278560, 1304192, 1329824, 1355456,
 1381088, 1406720, 1432352, 1457984, 1483616, 1509248, 1534880, 1560512,
 1586144, 1611776, 1634336, 1659968, 1685600, 1711232, 1736864, 1762496,
 1788128, 1813760, 1839392, 1865024, 1890656, 1916288, 1941920, 1967552,
 1993184, 2018816, 2044448, 2070080, 2095712, 2121344, 2146976, 2172608,
 2198240, 2223872, 2249504, 2275136, 2300768, 2326400, 2352032, 2377664,
 2403296, 2428928, 2451488, 2477120, 2502752, 2528384, 2554016, 2579648,
 2605280, 2630912, 2656544, 2682176, 2707808, 2733440, 2759072, 2784704,
 2810336, 2835968, 2861600, 2887232, 2912864, 2938496, 2964128, 2989760,
 3015392, 3041024, 3066656, 3092288, 3117920, 3143552, 3169184, 3194816,
 3220448, 3246080, 3268640, 3294272, 3319904, 3345536, 3371168, 3396800,
 3422432, 3448064, 3473696, 3499328, 3524960, 3550592, 3576224, 3601856,
 3627488, 3653120, 3678752, 3704384, 3730016, 3755648, 3781280, 3806912,
 3832544, 3858176, 3883808, 3909440, 3935072, 3960704, 3986336, 4011968,
 4037600, 4063232, 4085792, 4111424, 4137056,
 

 
 
tstm# mkdir sol2.5_cus

tstm# mount /dev/dsk/c1t0d0s2 /sol2.5_cus
 
 
 

================================================================================
Check origincal cdrom structure.
================================================================================

tstm# cd /cdrom

 
tstm# dir
total 22
drwxr-xr-x 9 root nobody 512 Mar 22 16:22 ./
drwxr-xr-x 32 root root 1536 Mar 22 16:53 ../
drwxr-xr-x 2 root nobody 512 Jul 26 1995 cde1_0_sparc/
lrwxrwxrwx 1 root nobody 19 Mar 22 16:22 cdrom0 ->
./solaris_2_5_sparc/
drwxr-xr-x 10 root nobody 512 Aug 24 1995 sol_2_3_hw894_sparc/
drwxr-xr-x 8 root nobody 512 Feb 10 1995 sol_2_4_hw1194_sparc/
drwxr-xr-x 8 root nobody 512 Mar 13 18:25 sol_2_4_hw395_sparc/
drwxr-xr-x 2 root nobody 512 Feb 13 1995 solaris_2_4_ab/
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 solaris_2_5_sparc/
drwxr-xr-x 2 root nobody 512 Oct 5 09:34 volume_name/
 

tstm# cd cdrom0
 
 
 

tstm# dir
total 28
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ./
drwxr-xr-x 9 root nobody 512 Mar 22 16:22 ../
dr-xr-xr-x 2 root sys 2048 Nov 2 05:08 s0/
drwxr-xr-x 16 root root 512 Nov 2 20:59 s1/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s2/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s3/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s4/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s5/
 
 
 
tstm# dir s0
total 214
dr-xr-xr-x 2 root sys 2048 Nov 2 05:08 ./
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ../
-r--r--r-- 1 root staff 50 Nov 2 05:08 .cdtoc
drwxr-xr-x 2 bin bin 2048 Nov 2 05:08 .install_config/
-r--r--r-- 1 root staff 470 Nov 2 05:08 .slicemapfile
-rw-r--r-- 1 root staff 5949 Nov 2 05:08 Copyright
drwxr-xr-x 18 root bin 4096 Nov 2 05:11 Patches/
drwxr-xr-x 191 root staff 24576 Nov 2 05:08 Solaris_2.5/
-rwxr-xr-x 1 root bin 45028 Oct 26 07:30 add_install_client*
drwxr-xr-x 3 bin bin 2048 Nov 2 04:44 auto_install_sample/
drwxr-xr-x 3 root staff 2048 Nov 2 04:41 export/
-rwxr-xr-x 1 root bin 12366 Oct 26 07:30 rm_install_client*
-rwxr-xr-x 1 root bin 6388 Oct 26 07:30 setup_install_server*
 
 

tstm# cat s0/.cdtoc
PRODNAME=Solaris
PRODVERS=2.5
PRODDIR=Solaris_2.5
 
 
 
tstm# cat s0/.slicemapfile
#
# @(#)slicemapfile 1.5 15:44:42 - 95/02/16
#
# Domestic Sparc CD
#
# a slice map file for install CD boot slices - maps platform (or not)
# or karch to an install boot slice.
#
# entries are one of:
# x "" <`uname -i`> exclude platform (must preceed "m" entries)
# used if the platform is not really in a karch
# p <slice> <`uname -i`> platform token entry (must preceed "m"
entries)
# m <slice> <`uname -m`> karch entry
#
m 2 sun4c
m 3 sun4m
m 4 sun4d
m 5 sun4u
 
 
 
tstm# dir s1
total 174
drwxr-xr-x 16 root root 512 Nov 2 20:59 ./
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ../
-rwxr-xr-x 1 root sys 1176 Oct 26 22:37 .stub.4x.check*
-rwxr-xr-x 1 root sys 6583 Oct 26 22:37 .stub.4x.cpio*
-rwxr-xr-x 1 root sys 4243 Oct 26 22:37 .stub.4x.part2*
drwxr-xr-x 2 root staff 512 Nov 2 20:59 a/
lrwxrwxrwx 1 root staff 9 Nov 2 20:42 bin -> ./usr/bin/
drwxr-xr-x 3 root staff 512 Nov 2 20:41 cdrom/
drwxrwxr-x 10 root sys 512 Nov 2 20:43 dev/
drwxrwxr-x 3 root sys 512 Nov 2 20:43 devices/
drwxrwxr-x 21 root sys 2560 Nov 2 20:58 etc/
drwxrwxr-x 4 root sys 512 Nov 2 20:52 export/
drwxrwxr-x 2 root sys 512 Nov 2 20:43 home/
drwxr-xr-x 9 root sys 512 Nov 2 20:42 kernel/
drwxrwxr-x 2 bin bin 512 Nov 2 20:46 kvm/
lrwxrwxrwx 1 root staff 9 Nov 2 20:42 lib -> ./usr/lib/
drwxrwxr-x 2 root sys 512 Nov 2 20:42 mnt/
lrwxrwxrwx 1 root staff 41 Nov 2 20:41 opt ->
./cdrom/export/exec/sparc.Solaris_2.5/opt
drwxr-xr-x 7 root sys 1024 Nov 2 20:45 platform/
drwxr-xr-x 2 root sys 512 Nov 2 20:42 proc/
-rw-r--r-- 1 root other 0 Nov 2 20:44 reconfigure
-rw-r--r-- 1 root staff 28672 Nov 2 20:58 root.proto
drwxrwxr-x 2 root sys 1024 Nov 2 20:59 sbin/
drwxrwxrwt 4 sys sys 512 Nov 2 20:58 tmp/
lrwxrwxrwx 1 root staff 37 Nov 2 20:41 usr ->
./cdrom/export/exec/sparc.Solaris_2.5/
lrwxrwxrwx 1 root staff 15 Nov 2 20:58 var -> ../tmp/root/var
 
 

===============================================================================
Check name of the script being run at startup time.

  co:234:respawn:/sbin/startup >>/dev/console 2>&1 </dev/console
===============================================================================

tstm# cat s1/etc/inittab
ap::sysinit:/sbin/autopush -f /etc/iu.ap
fs::sysinit:/sbin/rcS >>/dev/console 2>&1 </dev/console
is:2:initdefault:
p3:s1234:powerfail:/sbin/shutdown -y -i0 -g0 >/dev/console 2>&1
s0:0:wait:/sbin/rc0 off >>/dev/console 2>&1 </dev/console
s1:1:wait:/sbin/shutdown -y -iS -g0 >>/dev/console 2>&1 </dev/console
s2:23:wait:/sbin/rc2 >>/dev/console 2>&1 </dev/console
s3:3:wait:/sbin/rc3 >>/dev/console 2>&1 </dev/console
s5:5:wait:/sbin/rc5 ask >>/dev/console 2>&1 </dev/console
s6:6:wait:/sbin/rc6 reboot >>/dev/console 2>&1 </dev/console
of:0:wait:/sbin/uadmin 2 0 >>/dev/console 2>&1 </dev/console
fw:5:wait:/sbin/uadmin 2 2 >/dev/console 2>&1 </dev/console
RB:6:wait:/sbin/sh -c 'echo "\nThe system is being restarted."' >>/dev/console
2>&1
rb:6:wait:/sbin/uadmin 2 1 >>/dev/console 2>&1 </dev/console
co:234:respawn:/sbin/startup >>/dev/console 2>&1 </dev/console

tstm# dir s2
total 26
drwxr-xr-x 3 root root 512 Nov 2 21:01 ./
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ../
-rw-r--r-- 1 root staff 2 Nov 2 21:01 .SUNW-boot-redirect
drwx------ 2 root root 8192 Nov 2 20:41 lost+found/
 
 
 
tstm# cat s2/.SUNW-boot-redirect
1
 
 
 
tstm# dir s3
total 26
drwxr-xr-x 3 root root 512 Nov 2 21:01 ./
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ../
-rw-r--r-- 1 root staff 2 Nov 2 21:01 .SUNW-boot-redirect
drwx------ 2 root root 8192 Nov 2 20:41 lost+found/
 
 
 
tstm# cat s3/.SUNW-boot-redirect
1
 
 

tstm# dir s4
total 26
drwxr-xr-x 3 root root 512 Nov 2 21:01 ./
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ../
-rw-r--r-- 1 root staff 2 Nov 2 21:01 .SUNW-boot-redirect
drwx------ 2 root root 8192 Nov 2 20:41 lost+found/
 
 
 
tstm# cat s4/.SUNW-boot-redirect
1
 
 
 
tstm# dir s5
total 26
drwxr-xr-x 3 root root 512 Nov 2 21:01 ./
drwxr-xr-x 8 root nobody 512 Mar 22 15:17 ../
-rw-r--r-- 1 root staff 2 Nov 2 21:01 .SUNW-boot-redirect
drwx------ 2 root root 8192 Nov 2 20:41 lost+found/
 
 
 
tstm# cat s5/.SUNW-boot-redirect
1
 
 
 

tstm# cd /sol2.5_cus

tstm# pwd
/sol2.5_cus
 
 
 
tstm# df -k .
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1t0d0s2 1952789 9 1757510 0% /sol2.5_cus
 
 
 
===============================================================================
Kill the Volume Manager. Look at the structure and total sector sizes of the
original cdrom.
===============================================================================
 
tstm# eject
 
 
tstm# ps -ef | grep vold
    root 275 1 80 16:22:05 ? 0:04 /usr/sbin/vold
    root 462 413 15 16:56:14 pts/4 0:00 grep vold
 
 

tstm# kill -9 275
 
 
 
tstm# ps -ef | grep vold
    root 464 413 13 16:56:23 pts/4 0:00 grep vold
 
 
 
===============================================================================
Re-insert the original cdrom into the SUN cdrom drive.
===============================================================================
 
tstm# prtvtoc /dev/rdsk/c0t6d0s2
* /dev/rdsk/c0t6d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 640 sectors/track
* 1 tracks/cylinder
* 640 sectors/cylinder
* 2048 cylinders
* 2048 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 725120 2560 727679
* 735360 574720 1310079
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
       0 4 10 0 641280 641279
       1 2 10 641280 83840 725119
       2 2 10 725120 2560 727679
       3 2 10 727680 2560 730239
       4 2 10 730240 2560 732799
       5 2 10 732800 2560 735359

===============================================================================
Calculate the byte sizes for each file system:

  Sector Count * 512 bytes/sector

s0 = 328335360
s1 = 42926080
s2 through s5 = 1310720
===============================================================================

tstm# bc
641280*512
328335360
83840*512
42926080
2560*512
1310720
^D

===============================================================================
Extract s0 from the original cdrom (including the 2K disk label).
===============================================================================

tstm# dd if=/dev/rdsk/c0t6d0s0 of=s0 bs=8k
40080+0 records in
40080+0 records out

===============================================================================
Extract s1 through s5 file systems from the original cdrom.
===============================================================================
 
tstm# dd if=/dev/rdsk/c0t6d0s1 of=s1 bs=8k
5240+0 records in
5240+0 records out
 
 
tstm# dd if=/dev/rdsk/c0t6d0s2 of=s2 bs=8k
160+0 records in
160+0 records out
 
 
tstm# dd if=/dev/rdsk/c0t6d0s3 of=s3 bs=8k
160+0 records in
160+0 records out

tstm# dd if=/dev/rdsk/c0t6d0s4 of=s4 bs=8k
160+0 records in
160+0 records out
 
 
tstm# dd if=/dev/rdsk/c0t6d0s5 of=s5 bs=8k
160+0 records in
160+0 records out
 
 
 
===============================================================================
Compare the output of the file system sizes with the above calculations.
===============================================================================
 
tstm# dir
total 735852
drwxr-xr-x 3 root root 512 Apr 2 11:36 ./
drwxr-xr-x 32 root root 1536 Apr 1 10:01 ../
drwx------ 2 root root 8192 Mar 22 16:39 lost+found/
-rw-r--r-- 1 root other 328335360 Mar 22 17:36 s0
-rw-r--r-- 1 root other 42926080 Mar 22 17:47 s1
-rw-r--r-- 1 root other 1310720 Mar 22 17:59 s2
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s3
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s4
-rw-r--r-- 1 root other 1310720 Mar 22 18:01 s5

===============================================================================
Restart Volume Manager. If we don't restart Volume Manager, the system always
hangs when we capture a window history. This will be disastrous if we were
cutting a new cd at the time.
===============================================================================
 
tstm# umount /cdrom
 

===============================================================================
Eject the original cdrom from the SUN cdrom.
===============================================================================
 

tstm# /etc/init.d/volmgt start
volume management starting.
 
 
tstm# ps -ef | grep vold
    root 530 1 80 10:57:39 pts/5 0:03 /usr/sbin/vold
    root 629 424 14 12:30:57 pts/4 0:00 grep vold
 

===============================================================================
dd s1 file system to a raw partition then edit and add files to this
partition.

You must use the same count for records in/out when recreating this file
from the edited file system.
===============================================================================

tstm# dd if=s1 of=/dev/rdsk/c1t3d0s0 bs=8k
5240+0 records in
5240+0 records out

tstm# fsck /dev/rdsk/c1t3d0s0
** /dev/rdsk/c1t3d0s0
** Last Mounted on /50cdrom/sundist.base/mnt
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
881 files, 11096 used, 8347 free (15 frags, 2083 blocks, 0.1% fragmentation)

tstm# mount /dev/dsk/c1t3d0s0 /mnt

tstm# cd /mnt

tstm# df -k .
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1t3d0s0 38886 22192 12814 63% /mnt

tstm# dir
total 176
drwxr-xr-x 16 root root 512 Nov 2 20:59 ./
drwxr-xr-x 32 root root 1536 Apr 1 10:01 ../
-rwxr-xr-x 1 root sys 1176 Oct 26 22:37 .stub.4x.check*
-rwxr-xr-x 1 root sys 6583 Oct 26 22:37 .stub.4x.cpio*
-rwxr-xr-x 1 root sys 4243 Oct 26 22:37 .stub.4x.part2*
drwxr-xr-x 2 root staff 512 Nov 2 20:59 a/
lrwxrwxrwx 1 root staff 9 Nov 2 20:42 bin -> ./usr/bin/
drwxr-xr-x 3 root staff 512 Nov 2 20:41 cdrom/
drwxrwxr-x 10 root sys 512 Nov 2 20:43 dev/
drwxrwxr-x 3 root sys 512 Nov 2 20:43 devices/
drwxrwxr-x 21 root sys 2560 Nov 2 20:58 etc/
drwxrwxr-x 4 root sys 512 Nov 2 20:52 export/
drwxrwxr-x 2 root sys 512 Nov 2 20:43 home/
drwxr-xr-x 9 root sys 512 Nov 2 20:42 kernel/
drwxrwxr-x 2 bin bin 512 Nov 2 20:46 kvm/
lrwxrwxrwx 1 root staff 9 Nov 2 20:42 lib -> ./usr/lib/
drwxrwxr-x 2 root sys 512 Nov 2 20:42 mnt/
lrwxrwxrwx 1 root staff 41 Nov 2 20:41 opt ->
./cdrom/export/exec/sparc.Solaris_2.5/opt
drwxr-xr-x 7 root sys 1024 Nov 2 20:45 platform/
drwxr-xr-x 2 root sys 512 Nov 2 20:42 proc/
-rw-r--r-- 1 root other 0 Nov 2 20:44 reconfigure
-rw-r--r-- 1 root staff 28672 Nov 2 20:58 root.proto
drwxrwxr-x 2 root sys 1024 Nov 2 20:59 sbin/
drwxrwxrwt 4 sys sys 512 Nov 2 20:58 tmp/
lrwxrwxrwx 1 root staff 37 Nov 2 20:41 usr ->
./cdrom/export/exec/sparc.Solaris_2.5/
lrwxrwxrwx 1 root staff 15 Nov 2 20:58 var -> ../tmp/root/var

===============================================================================
Add version number to s1.
===============================================================================

tstm# touch version_1.0

tstm# cd sbin

tstm# dir
total 6092
drwxrwxr-x 2 root sys 1024 Nov 2 20:59 ./
drwxr-xr-x 16 root root 512 Nov 2 20:59 ../
-r-xr-xr-x 1 root staff 121336 Oct 25 03:59 adb*
-r-xr-xr-x 1 bin bin 118840 Oct 25 03:59 autopush*
-r-xr-xr-x 1 root staff 7688 Oct 26 22:25 bpgetfile*
-r-xr-xr-x 1 root staff 59156 Oct 25 04:01 cpio*
-rwxr-xr-x 1 root sys 3344 Oct 26 22:25 dial*
-rwxr-xr-x 1 root sys 6112 Oct 26 22:05 get_root*
-rwxr-xr-x 1 root sys 3744 Oct 26 22:25 getbootargs*
-r-xr-xr-x 1 bin bin 515272 Oct 25 04:06 hostconfig*
-r-xr-xr-x 1 bin bin 569792 Oct 25 04:09 ifconfig*
-r-xr-xr-x 1 root sys 246688 Oct 25 04:05 init*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 jsh*
-rwxr-xr-x 1 root sys 3040 Oct 26 22:25 mem*
-r-xr-xr-x 1 root staff 4088 Oct 25 04:08 mknod*
-r-xr-xr-x 1 bin bin 161140 Oct 25 04:22 mount*
-r-xr-xr-x 1 root sys 6908 Jan 1 1970 mountall*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc0*
-rwxr--r-- 1 root sys 1159 Jan 1 1970 rc1*
-rwxr-xr-x 1 root sys 17 Oct 26 22:30 rc2*
-rwxr--r-- 1 root sys 927 Jan 1 1970 rc3*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc5*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc6*
-rwxr-xr-x 1 root sys 16382 Oct 26 22:30 rcS*
-rwxr-xr-x 1 root staff 6060 Oct 25 04:12 reboot*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 sh*
-rwxr-xr-x 1 root sys 7309 Oct 26 22:30 startup*
-r-sr-xr-x 1 root sys 330836 Oct 25 04:15 su*
-rwxr-xr-x 1 root sys 1146 Oct 26 22:30 sulogin*
-rwxr-xr-x 1 root sys 10244 Oct 26 22:30 suninstall*
-rwxr--r-- 1 root sys 3156 Jan 1 1970 swapadd*
-r-xr-xr-x 1 bin bin 1180 Oct 25 04:15 sync*
-rwxr-xr-x 1 root sys 6909 Nov 2 20:45 sysconfig*
-r-xr-xr-x 1 root sys 105620 Oct 25 04:17 uadmin*
-r-xr-xr-x 1 bin bin 134932 Oct 25 04:22 umount*
-r-xr-xr-x 1 root sys 3225 Jan 1 1970 umountall*
-r-xr-xr-x 1 bin bin 110844 Oct 25 04:17 uname*

===============================================================================
Add the following to the file startup, ABOVE "# Determine if we are running
on a multi-byte image..."

  # RUN restore_sd0 TO RESTORE FILE SYSTEMS FROM 8MM TAPE
  . /sbin/restore_sd0
  exit
===============================================================================

tstm# cp -p startup startup.orig

tstm# vi startup

tstm# diff startup startup.orig
54,60d53
<
<
< # RUN restore_sd0 TO RESTORE FILE SYSTEMS FROM 8MM TAPE
< . /sbin/restore_sd0
< exit
<
<

tstm# cp -p startup /h/sysop/vlau/mkbit

tstm# dir
total 6132
drwxrwxr-x 2 root sys 1024 Apr 2 15:31 ./
drwxr-xr-x 16 root root 512 Nov 2 20:59 ../
-r-xr-xr-x 1 root staff 121336 Oct 25 03:59 adb*
-r-xr-xr-x 1 bin bin 118840 Oct 25 03:59 autopush*
-r-xr-xr-x 1 root staff 7688 Oct 26 22:25 bpgetfile*
-r-xr-xr-x 1 root staff 59156 Oct 25 04:01 cpio*
-rwxr-xr-x 1 root sys 3344 Oct 26 22:25 dial*
-rwxr-xr-x 1 root sys 6112 Oct 26 22:05 get_root*
-rwxr-xr-x 1 root sys 3744 Oct 26 22:25 getbootargs*
-r-xr-xr-x 1 bin bin 515272 Oct 25 04:06 hostconfig*
-r-xr-xr-x 1 bin bin 569792 Oct 25 04:09 ifconfig*
-r-xr-xr-x 1 root sys 246688 Oct 25 04:05 init*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 jsh*
-rwxr-xr-x 1 root sys 3040 Oct 26 22:25 mem*
-r-xr-xr-x 1 root staff 4088 Oct 25 04:08 mknod*
-r-xr-xr-x 1 bin bin 161140 Oct 25 04:22 mount*
-r-xr-xr-x 1 root sys 6908 Jan 1 1970 mountall*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc0*
-rwxr--r-- 1 root sys 1159 Jan 1 1970 rc1*
-rwxr-xr-x 1 root sys 17 Oct 26 22:30 rc2*
-rwxr--r-- 1 root sys 927 Jan 1 1970 rc3*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc5*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc6*
-rwxr-xr-x 1 root sys 16382 Oct 26 22:30 rcS*
-rwxr-xr-x 1 root staff 6060 Oct 25 04:12 reboot*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 sh*
-rwxr-xr-x 1 root sys 7394 Apr 2 15:40 startup*
-rwxr-xr-x 1 root other 7309 Oct 26 22:30 startup.orig*
-r-sr-xr-x 1 root sys 330836 Oct 25 04:15 su*
-rwxr-xr-x 1 root sys 1146 Oct 26 22:30 sulogin*
-rwxr-xr-x 1 root sys 10244 Oct 26 22:30 suninstall*
-rwxr--r-- 1 root sys 3156 Jan 1 1970 swapadd*
-r-xr-xr-x 1 bin bin 1180 Oct 25 04:15 sync*
-rwxr-xr-x 1 root sys 6909 Nov 2 20:45 sysconfig*
-r-xr-xr-x 1 root sys 105620 Oct 25 04:17 uadmin*
-r-xr-xr-x 1 bin bin 134932 Oct 25 04:22 umount*
-r-xr-xr-x 1 root sys 3225 Jan 1 1970 umountall*
-r-xr-xr-x 1 bin bin 110844 Oct 25 04:17 uname*

===============================================================================
Copy "restore_sd0" script to s1:/sbin directory.
===============================================================================

tstm# cp -p /h/sysop/vlau/mkbit/restore_sd0 .

tstm# cat restore_sd0
#!/sbin/sh

#############################################################################
# #
# File Name: restore_sd0 #
# #
# Date: April 2, 1996 #
# #
# Purpose: This /sbin/sh script first downloads the latest format.dat #
# to /tmp/root, then replaces /tmp/root/etc/format.dat with this #
# version. The script then repartitions the system disk, newfs's#
# all file systems on the system disk, restores file systems #
# from an 8mm tape, writes a boot block to /dev/dsk/c0t3d0s0, #
# and reboots the system. #
# #
#############################################################################

#############################################################################
# DEFINE VARIABLES #
#############################################################################

# dmesg VARIABLES
BOOTUP_FILE="./LastBootUp"
SRCH_KEY="`/usr/bin/uname -s` Release `/usr/bin/uname -r` Version "

# DISK REPARTITIONING VARIABLES
DISK_EVAL="" # variable that captures data from
                                    # format--used to test for unknown label
DISK_CYL="" # variable that captures total cylinder
                                    # from system disk
DISK_TYPE="" # variable that captures STXXXX from the
                                    # format command, e.g., ST410800N
DISK_SIZE="" # ST410800N=9GB, ST42400N=2GB
FS="" # file systems to be newfs'ed

# TAPE VARIABLES
TAPE_DRIVE_TEST="" # test for EXB-85 tape drive(s)
TAPE_DRIVE_TMP="" # locate the tape drive target
                                    # number, then translate it to
                                    # the format of /dev/rmt/#
TAPE_DRIVE="" # variable defining tape drive
                                    # number, e.g., 0, captured from
                                    # $TAPE_DRIVE_TMP
TAPE_COUNT=0 # variable to determine the number
                                    # of tapes detected in multiple drives
MULTI_FLAG="" # variable to check if tape has been
                                    # found in tape drive(s)
MULTI_DRIVES="" # this variable is used to test
                                    # multiple tape drives on line
TAPE_STATUS="" # check for mounted tape
MOUNTED="no" # variable to allow operator to
                                    # mount a tape in a while loop
GET_ANSWER="" # any operator response for inserting
                                    # tape into drive

#############################################################################
# CREATE CLEAN UP SUBROUTINE TO REMOVE ALL TMP FILES #
#############################################################################

cleanup()
{
  exit
}

#############################################################################
# CAPTURE dmesg TO /tmp/LastBootUp--WE NEED TO DETERMINE TAPE DRIVE NUMBER #
# FROM THIS FILE. #
#############################################################################

echo ""
echo "Capturing current dmesg in ./LastBootUp..."
/usr/sbin/dmesg > $BOOTUP_FILE
echo ""

# "cat -n" WILL GIVE US THE LINE NUMBER OF THE FILE--THIS IS USED INSTEAD OF
# "grep -n" BECAUSE THE LATTER DOES NOT grep A LINE THAT STARTS WITH A
# CONTROL CHARCTER LIKE ^M WHICH SOMETIMES STARTS THE SunOS BOOT LINE.

# BY USING "sort -r" WE ARE PUTTING THE LINES IN REVERSE ORDER, SO THAT WE
# CAN CAPTURE THE LAST (OR LATEST) INSTANCE OF THE BOOT dmesg; WE THEN
# SUBSTITUTE THE ENTIRE LINE STARTING WITH SunOS WITH NOTHING, LEAVING
# THE LINE NUMBER TO BE SET TO THE VARIABLE START_LINE

# DO NOT BREAK THIS LINE WITH \
START_LINE="`/usr/bin/cat -n $BOOTUP_FILE | /usr/bin/fgrep "$SRCH_KEY" |
/usr/bin/sort -r | /usr/bin/line | /usr/bin/awk '{print $1}'`"
                                       # get the line number of each
                                       # reboot start line that starts
                                       # with "SunOS Release 5.X Version."

# EDIT THE TMP FILE AND DELETE ALL LINES ABOVE START_LINE
# DO NOT PUT {} AROUND VARIABLE WHEN USED WITH expr

BEFORE_START=`/usr/bin/expr $START_LINE - 1`

# USE here document TO DELETE ALL LINES ABOVE START_LINE
/usr/bin/ed - $BOOTUP_FILE << EOF!
1,${BEFORE_START}d
w
q
EOF!

#############################################################################
# DETERMINE TAPE DRIVE AND TEST FOR 8MM TAPE AVAILABILITY. #
#############################################################################

echo "Waiting 30 seconds for tape to complete loading...\c"
sleep 30
echo ""

echo ""
echo "Checking for 8mm tape drive(s)..."

# DETERMINE TAPE DRIVE TARGET NUMBER

# FIRST TEST IF ANY EXB-85 TAPE DRIVES ARE ON LINE FROM STRIPPED DOWN VERSION
# OF dmesg WHICH WAS CAPTURED TO ./LastBootUp (DO NOT BREAK THIS LINE
# WITH \; OTHERWISE, VARIABLE WILL NOT BE SET)
# (e.g., st4)

TAPE_DRIVE_TEST=`/usr/bin/grep 'EXB-85' ${BOOTUP_FILE} | /usr/bin/awk -F:
'{print $1}' | /usr/bin/uniq`

# IF THE TAPE_DRIVE_TEST VARIABLE IS NOT EMPTY, EXB-85 DRIVE(S) HAVE BEEN
# DETECTED
if [ "${TAPE_DRIVE_TEST}" != "" ]; then

  # CHECK HOW MANY EXB-85 TAPE DRIVES ARE ON LINE
  for i in $TAPE_DRIVE_TEST
  do

    # GET THE TAPE DEVICE TARGET NUMBER LIKE esp@3,80000/st@4,0--YOU MUST
    # CAPTURE THE SCSI NUMBER OR YOU MAY CAPTURE TWO DIFFERENT NUMBERS
    # FROM TWO DIFFERENT SCSI CONTROLLERS
    TAPE_DRIVE_TMP=`/usr/bin/grep "^${i} is" ${BOOTUP_FILE} | /usr/bin/awk -F/
'{print $5 "/" $6}'`

    # THEN, USING THE TARGET NUMBER CAPTURED, LOCATE THE LOGICAL DEVICE
    # NUMBER, LIKE 0 (AS IN /dev/rmt/0)

    # DO NOT BREAK THIS LINE WITH \; OTHERWISE, VARIABLE WILL NOT BE SET)
    # (e.g., 0)
    TAPE_DRIVE_TMP=`/usr/bin/ls -Fla /dev/rmt | /usr/bin/grep
"${TAPE_DRIVE_TMP}" | /usr/bin/awk '{print $9}' | /usr/bin/cut -c1 |
/usr/bin/uniq `

    # IF MULTIPLE TAPE DRIVES ARE FOUND, DISPLAY ALL DEVICES
    # THEN SELECT THE DRIVE THAT HAS A TAPE IN IT; IF BOTH 8mm DRIVES
    # HAVE TAPES, PROMPT OPERATOR TO SELECT ONE

    if [ "`echo ${TAPE_DRIVE_TEST} | wc -w`" -gt "1" ]; then

      # CHECK IF ANY TAPE IS INSERTED IN ANY DRIVE
      ( /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE_TMP} status ) >/dev/null 2>&1

      # IF EXIT STATUS IS NO GOOD (0--GOOD; NON-ZERO--BAD)
      if [ $? != "0" ]; then
        # IF NO TAPE IN THIS DRIVE, DISPLAY THIS MESSAGE
        echo ".../dev/rmt/${TAPE_DRIVE_TMP} is on line but NO tape is in the
drive"
      else
        # IF TAPE IS FOUND IN THIS DRIVE, DISPLAY THIS MESSAGE
        echo ".../dev/rmt/${TAPE_DRIVE_TMP} is on line and tape is loaded in
the drive"
        TAPE_COUNT="`expr "${TAPE_COUNT}" + 1`"
        TAPE_DRIVE=${TAPE_DRIVE_TMP}
        MULTI_FLAG="good"
      fi

      MULTI_DRIVES="yes"

    else
      # IF ONLY ONE TAPE DRIVE IS FOUND, DEFINE TAPE DRIVE
      TAPE_DRIVE=${TAPE_DRIVE_TMP}
    fi
  done # END for i in $TAPE_DRIVE_TEST

  echo ""

else

  # NO TAPE DRIVES FOUND ON LINE (dmesg DID NOT CAPTURE ANY ^st)
  echo ""
  echo "No 8mm tape drives have been found. You may need to do a"
  echo "reconfigure boot (> boot -r OR reboot -- -r) for the system"
  echo "to register your tape drive(s)."
  echo ""
  exit 1
fi # END if [ "${TAPE_DRIVE_TEST}" != "" ]; then

# IF MULTIPLE TAPE DRIVES ARE FOUND, CHECK FOR TAPE DRIVE WITH A TAPE IN IT;
# IF TAPES ARE DETECTED IN MORE THAN ONE TAPE DRIVE, OR IF NO TAPES HAVE
# BEEN DETECTED IN ANY DRIVE, ASK OPERATOR WHICH DRIVE TO USE, AND INSERT
# A TAPE, IF APPICABLE

if [ "${MULTI_DRIVES}" = "yes" ]; then

  # IF NO TAPE WAS DETECTED IN MULTI-DRIVES SITUATION, REMIND USER TO
  # INSERT A TAPE IN THE TAPE DRIVE
  if [ "${MULTI_FLAG}" != "good" ]; then
    echo ^G^G^G
    echo "BE SURE TO INSERT A TAPE INTO ANY OF YOUR 8mm DRIVE NOW!!!"
    echo ""
    echo "Enter tape drive number (e.g., 0, 1, etc.) to be used: /dev/rmt/\c"
    read TAPE_DRIVE
  else
    if [ ${TAPE_COUNT} -gt 1 ]; then
      echo "Tapes are found in more than one tape drive."
      echo ""
      echo "Enter tape drive number (e.g., 0, 1, etc.) to be used:
/dev/rmt/\c"
      read TAPE_DRIVE
    fi
  fi

  # CHECK FOR VALIDITY OF USER REPLY
  ( /usr/bin/ls /dev/rmt/${TAPE_DRIVE} ) > /dev/null 2>&1

  # IF STATUS IS BAD
  if [ $? != "0" ]; then
    # THE REQUESTED TAPE DRIVE IS NOT RECOGNIZED BY dmesg
    echo ""
    echo "/dev/rmt/${TAPE_DRIVE} is not a valid drive on this system."
    echo ""
    echo "You may need to do a reconfigure boot (> boot -r OR "
    echo "reboot -- -r) for the system to register your tape drive."
    echo "Exiting script..."
    echo ""
    cleanup
  fi
fi # END if [ "${MULTI_DRIVES}" = "yes" ]

# CHECK TAPE DRIVE STATUS TO SEE IF A TAPE HAS BEEN MOUNTED
while [ "${MOUNTED}" = "no" ]
do
  ( /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} status ) > /dev/null 2>&1

  # IF STATUS IS NO GOOD (0--TAPE IS MOUNTED; NON-ZERO--NOT MOUNTED)
   if [ $? != "0" ]; then
    echo ""
    echo "Tape is not mounted in /dev/rmt/${TAPE_DRIVE}"
    echo ""
    echo "Please mount tape and make sure that it is NOT write-protected."
    echo "Wait for the tape drive light to stop flashing then press"
    echo "<RETURN> to continue: "

    # THIS RESPONSE IS JUST A DEVICE TO GIVE THE OPERATOR TIME TO
    # INSERT A TAPE; THE TEXTUAL PORTION OF THE RESPONSE IS IRREREVANT
    read GET_ANSWER

    MOUNTED="no"
  else
    MOUNTED="yes"
  fi
done

#############################################################################
# IF TAPE DRIVE IS TESTED AND READY, RETRIEVE 2ND FILE (TAR FORMAT) FROM #
# TAPE (format.dat) AND REPLACE THE ONE IN /tmp/root/etc. #
#############################################################################

if [ "${MOUNTED}" = "yes" ]; then
  echo "Tape drive to be used is /dev/rmt/${TAPE_DRIVE}."
  echo ""
  echo "Downloading new format.dat from tape...\c"
  /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} rewind
  /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE}n fsf 1
  /usr/sbin/tar xvf /dev/rmt/${TAPE_DRIVE}n
  echo ""
  echo ""
  # COPY format.dat FROM TAPE TO /tmp/root/etc
  echo "Replacing format.dat in /tmp/root/etc..."
  cp format.dat /tmp/root/etc
  echo ""
else
  echo ""
  echo "No tape found in 8mm tape drive(s)."
  echo "Exiting script..."
  cleanup
fi

#############################################################################
# CHECK FOR NEW SYSTEM DISK--WITH unknown LABEL. RELABEL IT IF FOUND. #
#############################################################################

# REMEMBER TO USE grep -w TO LOOK FOR THE WORD unknown ONLY
# THE SOLARIS FORMAT IS AS FOLLOWS:
# 0. c0t2d0 <SEAGATE-ST42400N-0111 cyl 2604 alt 2 hd 19 sec 84>
# 1. c0t3d0 <Seagate Elite ST42400N cyl 2700 alt 2 hd 19 sec 81>

# THIS WILL RETURN THE VALUE 1 IF sd0 IS OF "drive type unknown"
DISK_EVAL=`echo | /usr/sbin/format | grep c0t3d0 | grep -w 'unknown' | awk
'{print $1}' | sed 's/\.//'`

# IF $DISK_EVAL IS NOT EMPTY, THE SYSTEM DISK HAS NO LABEL. LABEL THE DISK
# AUTOMATICALLY FOR 9GB DISK (TOTAL CYL WiLL BE 4923)--THE 15TH LABEL IN
# THE NEW format.dat IS FOR 2GB, THE 16TH IS FOR 9GB

echo "Writing label to system disk c0t3d0..."
echo ""

if [ "${DISK_EVAL}" != "" ]; then
  echo "type
        16
        label
        y
        q" | /usr/sbin/format -d c0t3d0 > /dev/null 2>&1
else
  # OTHERWISE, RELABEL DISK IN CASE BRAND NEW DISK HAS NOT BEEN LABELED
  echo "label
        y
        q" | /usr/sbin/format -d c0t3d0 > /dev/null 2>&1
fi

#############################################################################
# CAPTURE SYSTEM DISK TOTAL CYLINDER SIZE AND DISK TYPE (2GB, 9GB, ETC.) #
#############################################################################

DISK_CYL=`echo | /usr/sbin/format | grep c0t3d0 | grep -w 'cyl' | sed
's/^.*cyl //' | awk '{print $1}'`

DISK_TYPE=`echo | format | grep c0t3d0 | grep -w 'cyl'`

# TEST FOR 2.4GB DISK
( echo $DISK_TYPE | grep ST42400N ) > /dev/null
if [ $? = "0" ]; then
  DISK_SIZE=2GB
fi

# TEST FOR 9.1GB DISK
( echo $DISK_TYPE | grep ST410800N ) > /dev/null
if [ $? = "0" ]; then
  DISK_SIZE=9GB
fi

#############################################################################
# PARTITION SYSTEM DISK. #
#############################################################################

# DEFINE START AND TOTAL CYLINDER FOR EACH SLICE
case $DISK_SIZE in
  2GB)
    START_0="0"
    TOTAL_0="107c"
    START_1="107"
    TOTAL_1="86c"
    START_2="0"
    TOTAL_2="${DISK_CYL}c"
    START_3="193"
    TOTAL_3="533c"
    START_4="726"
    TOTAL_4="67c"
    START_5="793"
    TOTAL_5="341c"
    START_6="1134"
    TOTAL_6="333c"
    START_7="1467"
    TOTAL_7="`expr "${DISK_CYL}" - "${START_7}"`c"
    ;;
  9GB)
    START_0="0"
    TOTAL_0="58c"
    START_1="58"
    TOTAL_1="371c"
    START_2="0"
    TOTAL_2="${DISK_CYL}c"
    START_3="429"
    TOTAL_3="1753c"
    START_4="2182"
    TOTAL_4="58c"
    START_5="2240"
    TOTAL_5="371c"
    START_6="2611"
    TOTAL_6="172c"
    START_7="2783"
    TOTAL_7="`expr "${DISK_CYL}" - "${START_7}"`c"
    ;;
esac

# REPARTITION sd0
echo "Repartitioning system disk c0t3d0..."
echo "p
0

${START_0}
${TOTAL_0}
1

${START_1}
${TOTAL_1}
2

${START_2}
${TOTAL_2}
3

${START_3}
${TOTAL_3}
4

${START_4}
${TOTAL_4}
5

${START_5}
${TOTAL_5}
6

${START_6}
${TOTAL_6}
7

${START_7}
${TOTAL_7}
name
c0t3d0
label
y
quit
quit" | /usr/sbin/format -d c0t3d0 > /dev/null 2>&1

#############################################################################
# newfs SYSTEM DISK FILE SYSTEMS. #
#############################################################################

PATH=/usr/bin:/usr/sbin;export PATH

# newfs ROOT FILE SYSTEM
echo ""
echo "newfs /dev/rdsk/c0t3d0s0..."
echo ""
/usr/sbin/newfs /dev/rdsk/c0t3d0s0 < /dev/null

# newfs /opt, /export, /export/swap, /usr, AND /tbd
FS="3 4 5 6 7"

for i in ${FS}
do
  echo ""
  echo "newfs /dev/rdsk/c0t3d0s${i}..."
  echo ""
  /usr/sbin/newfs -m 1 /dev/rdsk/c0t3d0s${i} < /dev/null
done

#############################################################################
# RESTORE FILE SYSTEMS FROM 8MM TAPE. #
#############################################################################

cd /

# WE ARE NOW AT THE THIRD FILE (FILE 2 ON TAPE)--FIRST ASCII FILE IS TOC,
# SECOND TAR FILE IS format.dat

# RESTORE /h (s7), /export/swap (s5), /export (s4), /tmp_opt_var (s3),
# /usr (s6), AND / (s0)
echo ""

for i in 7 5 4 3 6 0
do
  echo ""
  echo "Restoring files from 8mm tape to /dev/dsk/c0t3d0s${i}..."
  echo ""
  /usr/sbin/mount /dev/dsk/c0t3d0s${i} /a
  cd /a
  /usr/sbin/ufsrestore rvf /dev/rmt/${TAPE_DRIVE}n > /dev/null

  # ERROR CHECKING, IF ufsrestore FAILS, QUIT THE SCRIPT
  if [ $? != "0" ]; then
    echo ""
    echo "RESTORE FROM TAPE FAILED. EXITING SCRIPT..."
    echo ""
    exit 1
  else
    /usr/bin/rm restoresymtable
    cd /
    /usr/sbin/sync;/usr/sbin/sync;/usr/sbin/sync
    /usr/sbin/umount /a
  fi
done

#############################################################################
# WRITE BOOT BLOCK. #
#############################################################################

echo ""
echo "Writing boot block..."

# SOLARIS 2.5 HAS CHANGED THE COMMAND ON installboot
if [ "`/usr/bin/uname -r`" -eq "5.5" ]; then
  /usr/sbin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk
/dev/rdsk/c0t3d0s0
else
  # SOLARIS 2.4 OR EARLIER VERSION
  /usr/sbin/installboot /usr/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0
fi

#############################################################################
# REWIND TAPE AND REBOOT SYSTEM. #
#############################################################################

echo ""
echo "Rewinding tape..."
/usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} rewoff

echo ""
echo "Rebooting system with reconfigure boot..."
/usr/sbin/reboot -- -r

tstm# dir
total 6144
drwxrwxr-x 2 root sys 1024 Apr 2 15:31 ./
drwxr-xr-x 16 root root 512 Nov 2 20:59 ../
-r-xr-xr-x 1 root staff 121336 Oct 25 03:59 adb*
-r-xr-xr-x 1 bin bin 118840 Oct 25 03:59 autopush*
-r-xr-xr-x 1 root staff 7688 Oct 26 22:25 bpgetfile*
-r-xr-xr-x 1 root staff 59156 Oct 25 04:01 cpio*
-rwxr-xr-x 1 root sys 3344 Oct 26 22:25 dial*
-rwxr-xr-x 1 root sys 6112 Oct 26 22:05 get_root*
-rwxr-xr-x 1 root sys 3744 Oct 26 22:25 getbootargs*
-r-xr-xr-x 1 bin bin 515272 Oct 25 04:06 hostconfig*
-r-xr-xr-x 1 bin bin 569792 Oct 25 04:09 ifconfig*
-r-xr-xr-x 1 root sys 246688 Oct 25 04:05 init*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 jsh*
-rwxr-xr-x 1 root sys 3040 Oct 26 22:25 mem*
-r-xr-xr-x 1 root staff 4088 Oct 25 04:08 mknod*
-r-xr-xr-x 1 bin bin 161140 Oct 25 04:22 mount*
-r-xr-xr-x 1 root sys 6908 Jan 1 1970 mountall*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc0*
-rwxr--r-- 1 root sys 1159 Jan 1 1970 rc1*
-rwxr-xr-x 1 root sys 17 Oct 26 22:30 rc2*
-rwxr--r-- 1 root sys 927 Jan 1 1970 rc3*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc5*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc6*
-rwxr-xr-x 1 root sys 16382 Oct 26 22:30 rcS*
-rwxr-xr-x 1 root staff 6060 Oct 25 04:12 reboot*
-rwxr--r-- 1 root other 16869 Apr 3 08:51 restore_sd0*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 sh*
-rwxr-xr-x 1 root sys 7394 Apr 2 15:40 startup*
-rwxr-xr-x 1 root other 7309 Oct 26 22:30 startup.orig*
-r-sr-xr-x 1 root sys 330836 Oct 25 04:15 su*
-rwxr-xr-x 1 root sys 1146 Oct 26 22:30 sulogin*
-rwxr-xr-x 1 root sys 10244 Oct 26 22:30 suninstall*
-rwxr--r-- 1 root sys 3156 Jan 1 1970 swapadd*
-r-xr-xr-x 1 bin bin 1180 Oct 25 04:15 sync*
-rwxr-xr-x 1 root sys 6909 Nov 2 20:45 sysconfig*
-r-xr-xr-x 1 root sys 105620 Oct 25 04:17 uadmin*
-r-xr-xr-x 1 bin bin 134932 Oct 25 04:22 umount*
-r-xr-xr-x 1 root sys 3225 Jan 1 1970 umountall*
-r-xr-xr-x 1 bin bin 110844 Oct 25 04:17 uname*

===============================================================================
Compare our new version of format.dat with the version on the cdrom disk.
===============================================================================

tstm# cd ../etc

tstm# dir format.dat
lrwxrwxrwx 1 root staff 24 Nov 2 20:58 format.dat ->
/tmp/root/etc/format.dat

tstm# cd /mnt/tmp/root/etc

tstm# diff format.dat /h/sysop/vlau/mkbit/format.dat
233a234,239
> # Seagate ST42400N (Seagate 2 GB)
> disk_type = "Seagate Elite ST42400N" \
> : ctlr = SCSI \
> : fmt_time = 90 : trks_zone = 9 \
> : ncyl = 2624 : acyl = 2 : pcyl = 2626 : nhead = 19 : nsect = 81 \
> : rpm = 5400 : bpt = 42000
234a241,247
> # Seagate ST410800N (Seagate Elite 9 GB)
> disk_type = "Seagate ST410800N" \
> : ctlr = SCSI : fmt_time = 8 \
> : ncyl = 4923 : acyl = 2 : pcyl = 4925 : nhead = 27 : nsect = 133 \
> : rpm = 5400 : bpt = 68096
>
>
417a431,442
>
> partition = "Seagate Elite ST42400N" \
> : disk = "Seagate Elite ST42400N" : ctlr = SCSI \
> : 0 = 0, 40014 : 1 = 26, 130815 : 2 = 0, 4155300 : 3 = 0, 2046870 \
> : 4 = 1330, 2108430 : 5 = 377, 1432809 : 6 = 111, 409374 \
> : 7 = 1308, 2142288
>
> partition = "Seagate ST410800N" \
> : disk = "Seagate ST410800N" : ctlr = SCSI \
> : 0 = 0, 204687 : 1 = 57, 409374 : 2 = 0, 17678493 : 3 = 171, 4097331 \
> : 4 = 1312, 4097331 : 5 = 2453, 4097331 : 6 = 3594, 4097331 \
> : 7 = 4735, 675108

===============================================================================
Write the customized s1 file system to a file.
===============================================================================

tstm# cd /sol2.5_cus

tstm# sync;sync;sync;umount /mnt

tstm# dir
total 735852
drwxr-xr-x 3 root root 512 Apr 3 11:36 ./
drwxr-xr-x 32 root root 1536 Apr 1 10:01 ../
drwx------ 2 root root 8192 Mar 22 16:39 lost+found/
-rw-r--r-- 1 root other 328335360 Mar 22 17:36 s0
-rw-r--r-- 1 root other 42926080 Mar 22 17:47 s1
-rw-r--r-- 1 root other 1310720 Mar 22 17:59 s2
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s3
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s4
-rw-r--r-- 1 root other 1310720 Mar 22 18:01 s5

tstm# mv s1 s1.orig

tstm# dd if=/dev/rdsk/c1t3d0s0 of=s1 bs=8k count=5240
5240+0 records in
5240+0 records out

tstm# dir
total 819756
drwxr-xr-x 3 root root 512 Apr 3 15:30 ./
drwxr-xr-x 32 root root 1536 Apr 1 10:01 ../
drwx------ 2 root root 8192 Mar 22 16:39 lost+found/
-rw-r--r-- 1 root other 328335360 Mar 22 17:36 s0
-rw-r--r-- 1 root other 42926080 Apr 3 15:46 s1
-rw-r--r-- 1 root other 42926080 Mar 22 17:47 s1.orig
-rw-r--r-- 1 root other 1310720 Mar 22 17:59 s2
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s3
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s4
-rw-r--r-- 1 root other 1310720 Mar 22 18:01 s5

===============================================================================
Concatenate all file systems into one file.
===============================================================================

tstm# foreach i (0 1 2 3 4 5)
? cat s$i >> sol25.image
? end

tstm# dir
total 1555500
drwxr-xr-x 3 root root 512 Apr 3 15:49 ./
drwxr-xr-x 32 root root 1536 Apr 1 10:01 ../
-rw-r--r-- 1 root other 328335360 Mar 22 17:36 s0
-rw-r--r-- 1 root other 42926080 Apr 3 15:46 s1
-rw-r--r-- 1 root other 42926080 Mar 22 17:47 s1.orig
-rw-r--r-- 1 root other 1310720 Mar 22 17:59 s2
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s3
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s4
-rw-r--r-- 1 root other 1310720 Mar 22 18:01 s5
-rw-r--r-- 1 root other 376504320 Apr 3 15:56 sol25.image

===============================================================================
The size of all s* file systems should equal to sol25.image.
===============================================================================

tstm# bc
376504320-328335360-42926080-1310720-1310720-1310720-1310720
0

================================================================================
IF this is a tmp license, be sure to start the license.
================================================================================
tstm# /h/GEAR/gear_license/driver_license

===============================================================================
Use GEAR to create a foreign image on the new cd from the above combined file.

Insert a blank cd into the CD-R drive.
===============================================================================

tstm# msgen
                      Copyright(c) 1991-1995 Elektroson
                 GEAR Multi Media Version 3.24. Jan 16 1996
                      Orange Book Multi-session Utility
--------------------------------------------------------------------------------
 PINNACLE RCD-1000 revision 1.32 found on Target Nr 5
                                                                              
 No volumes found.
                                                                              
 CD> write sol25.image X /1
 Track 1: CD-ROM mode 1 track. Image: sol25.image.
           Sector size 2048. Pregap (150 sect.) not present.
 The relevant settings for the current CD-R recorder are:
 ========================================================
 Recording of disc disabled.
 Current write method: track at once recording.
 Number of copies to write = 1.
 1x real time speed selected.
 Disc fixation enabled.
 Multi-session writing enabled.
 QUESTION: Do you want to change the current setup? Y/N (N)y
 QUESTION: Enable recording of disc? Y/N (N)y
 Write method (1 = disc at once, 2 = track at once, 3 = fixed packets):
  (1 <= value <= 3)(2)2
 Number of copies to write? (1 <= value <= 1000)(1)1
 Recording speed (x real-time)? (1 <= value <= 6)(1)1
 QUESTION: Enable disc fixation? Y/N (Y)y
 QUESTION: Enable multi-session writing? Y/N (Y)n
 Blank 12 cm. CD-R disc found in unit number 0.
 Initializing writing of disc...please wait...
 Writing track 1 to CD recording unit.
       The size of track 1 in bytes = 376504320.
 183840 frames of size 2048 written = 376504320 bytes.
 track 1 is successfully transferred.
                                                                              
 Recording completed.
 Verifying track 1.
       The size of track 1 in bytes = 376504320.
 183840 frames of size 2048 verified = 376504320 bytes.
 track 1 is successfully verified.
                                                                              
                                                                              
 CD> exit

===============================================================================
Post customization file checking only.
===============================================================================

tstm# dir
total 1555506
drwxr-xr-x 3 root root 512 Apr 3 17:25 ./
-rw-r--r-- 1 root other 2048 Mar 22 17:00 boot_label
drwx------ 2 root root 8192 Mar 22 16:39 lost+found/
-rw-r--r-- 1 root other 328335360 Mar 22 17:36 s0
-rw-r--r-- 1 root other 42926080 Apr 3 15:46 s1
-rw-r--r-- 1 root other 42926080 Mar 22 17:47 s1.orig
-rw-r--r-- 1 root other 1310720 Mar 22 17:59 s2
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s3
-rw-r--r-- 1 root other 1310720 Mar 22 18:00 s4
-rw-r--r-- 1 root other 1310720 Mar 22 18:01 s5
-rw-r--r-- 1 root other 376504320 Apr 2 15:56 sol25.image
-rw-r--r-- 1 root other 1034 Apr 3 15:59 wo_ident
-rw-r--r-- 1 root other 785 Apr 3 17:25 wo_result

tstm# file wo*
wo_ident: English text
wo_result: English text

tstm# cat wo_ident
Mastering information file to accompany premaster tapes and CD-R discs.
GEAR image building and premastering software, Elektroson 1995.
Mastering order references (customer information):
- Customer name:
- Customer contact:
- Telephone number:
- Origination date: 4-3-96
- Master ID code:
- Customer reference code:
- Disc title:

- Number of tracks: 1
- Recommended LEAD IN period for mastering: 180 seconds
- Recommended LEAD OUT period for mastering: 210 seconds

TRACK INDEX CONTR NR OF TYPE PRESENT SECTOR START TIME DESCRIPTION
             FIELD SECTORS ON DISC SIZE MIN SEC FRM
  01 00 0100 150 mode 1 YES 2048 00 00 00 pregap
  01 01 0100 183990 mode 1 YES 2048 00 02 00 Mode 1 track
  aa 01 0000 15750 CD-DA YES 0 40 55 15 lead out

Contr/Addr Track MIN SEC FRAME
     41 01 00 02 00
     41 a0 01 00 00
     41 a1 01 00 00
     41 a2 40 55 15

tstm# cat wo_result
CD recording module - internal software results:
Execute result: 0.
Produce disc result: 0.
Write consecutive tracks result: 0.
Write track result: 0.
Write track data result: 0.
Read image result: 0.
CD recording device driver results:
  Open driver results: 0, 0.
  Test unit results: 0, 0.
  Request sense results: 0, 0.
  Start disc writing results: 0, 0.
  Start track writing results: 0, 0.
  Write data results: 0, 0.
  End track writing results: 0, 0.
  Finish disc results: 0, 0.
  Check unit results: 0, 0.
  Unit control results: 0, 0.
  Get disc info results: 0, 0.
  Read data results: 0, 0.
  Set read format results: 0, 0.
  Close driver results: 0, 0.
Sense key returned by CD recording unit (hex) = 6h.
Additional sense code returned by CD recording unit (hex) = 28h.

===============================================================================
Volume Manager IS running. Insert the newly created cdrom into the drive and
check its contents.
===============================================================================

tstm# cd /cdrom

tstm# dir
total 22
drwxr-xr-x 9 root nobody 512 Apr 3 13:11 ./
drwxr-xr-x 32 root root 1536 Apr 1 10:01 ../
drwxr-xr-x 2 root nobody 512 Jul 26 1995 cde1_0_sparc/
lrwxrwxrwx 1 root nobody 19 Apr 3 13:11 cdrom0 ->
./solaris_2_5_sparc/
drwxr-xr-x 10 root nobody 512 Aug 24 1995 sol_2_3_hw894_sparc/
drwxr-xr-x 8 root nobody 512 Feb 10 1995 sol_2_4_hw1194_sparc/
drwxr-xr-x 8 root nobody 512 Mar 13 18:25 sol_2_4_hw395_sparc/
drwxr-xr-x 2 root nobody 512 Feb 13 1995 solaris_2_4_ab/
drwxr-xr-x 8 root nobody 512 Apr 3 13:10 solaris_2_5_sparc/
drwxr-xr-x 2 root nobody 512 Oct 5 1995 volume_name/

tstm# cd cdrom0

tstm# dir
total 28
drwxr-xr-x 8 root nobody 512 Apr 3 13:10 ./
drwxr-xr-x 9 root nobody 512 Apr 3 13:11 ../
dr-xr-xr-x 2 root sys 2048 Nov 2 05:08 s0/
drwxr-xr-x 16 root root 512 Apr 3 08:33 s1/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s2/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s3/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s4/
drwxr-xr-x 3 root root 512 Nov 2 21:01 s5/

tstm# dir s1
total 174
drwxr-xr-x 16 root root 512 Apr 3 08:33 ./
drwxr-xr-x 8 root nobody 512 Apr 3 13:10 ../
-rwxr-xr-x 1 root sys 1176 Oct 26 22:37 .stub.4x.check*
-rwxr-xr-x 1 root sys 6583 Oct 26 22:37 .stub.4x.cpio*
-rwxr-xr-x 1 root sys 4243 Oct 26 22:37 .stub.4x.part2*
drwxr-xr-x 2 root staff 512 Nov 2 20:59 a/
lrwxrwxrwx 1 root staff 9 Nov 2 20:42 bin -> ./usr/bin/
drwxr-xr-x 3 root staff 512 Nov 2 20:41 cdrom/
drwxrwxr-x 10 root sys 512 Nov 2 20:43 dev/
drwxrwxr-x 3 root sys 512 Nov 2 20:43 devices/
drwxrwxr-x 21 root sys 2560 Nov 2 20:58 etc/
drwxrwxr-x 4 root sys 512 Nov 2 20:52 export/
drwxrwxr-x 2 root sys 512 Nov 2 20:43 home/
drwxr-xr-x 9 root sys 512 Nov 2 20:42 kernel/
drwxrwxr-x 2 bin bin 512 Nov 2 20:46 kvm/
lrwxrwxrwx 1 root staff 9 Nov 2 20:42 lib -> ./usr/lib/
drwxrwxr-x 2 root sys 512 Nov 2 20:42 mnt/
lrwxrwxrwx 1 root staff 41 Nov 2 20:41 opt ->
./cdrom/export/exec/sparc.Solaris_2.5/opt
drwxr-xr-x 7 root sys 1024 Nov 2 20:45 platform/
drwxr-xr-x 2 root sys 512 Nov 2 20:42 proc/
-rw-r--r-- 1 root other 0 Nov 2 20:44 reconfigure
-rw-r--r-- 1 root staff 28672 Nov 2 20:58 root.proto
drwxrwxr-x 2 root sys 1024 Apr 2 15:31 sbin/
drwxrwxrwt 4 sys sys 512 Nov 2 20:58 tmp/
lrwxrwxrwx 1 root staff 37 Nov 2 20:41 usr ->
./cdrom/export/exec/sparc.Solaris_2.5/
lrwxrwxrwx 1 root staff 15 Nov 2 20:58 var -> ../tmp/root/var
-rw-r--r-- 1 root other 0 Apr 3 08:33 version_1.0

tstm# dir s1/sbin
total 6144
drwxrwxr-x 2 root sys 1024 Apr 2 15:31 ./
drwxr-xr-x 16 root root 512 Apr 3 08:33 ../
-r-xr-xr-x 1 root staff 121336 Oct 25 03:59 adb*
-r-xr-xr-x 1 bin bin 118840 Oct 25 03:59 autopush*
-r-xr-xr-x 1 root staff 7688 Oct 26 22:25 bpgetfile*
-r-xr-xr-x 1 root staff 59156 Oct 25 04:01 cpio*
-rwxr-xr-x 1 root sys 3344 Oct 26 22:25 dial*
-rwxr-xr-x 1 root sys 6112 Oct 26 22:05 get_root*
-rwxr-xr-x 1 root sys 3744 Oct 26 22:25 getbootargs*
-r-xr-xr-x 1 bin bin 515272 Oct 25 04:06 hostconfig*
-r-xr-xr-x 1 bin bin 569792 Oct 25 04:09 ifconfig*
-r-xr-xr-x 1 root sys 246688 Oct 25 04:05 init*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 jsh*
-rwxr-xr-x 1 root sys 3040 Oct 26 22:25 mem*
-r-xr-xr-x 1 root staff 4088 Oct 25 04:08 mknod*
-r-xr-xr-x 1 bin bin 161140 Oct 25 04:22 mount*
-r-xr-xr-x 1 root sys 6908 Jan 1 1970 mountall*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc0*
-rwxr--r-- 1 root sys 1159 Jan 1 1970 rc1*
-rwxr-xr-x 1 root sys 17 Oct 26 22:30 rc2*
-rwxr--r-- 1 root sys 927 Jan 1 1970 rc3*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc5*
-rwxr--r-- 3 root sys 1776 Jan 1 1970 rc6*
-rwxr-xr-x 1 root sys 16382 Oct 26 22:30 rcS*
-rwxr-xr-x 1 root staff 6060 Oct 25 04:12 reboot*
-rwxr--r-- 1 root other 16869 Apr 3 08:51 restore_sd0*
-r-xr-xr-x 2 bin root 189364 Oct 25 04:16 sh*
-rwxr-xr-x 1 root sys 7394 Apr 2 15:40 startup*
-rwxr-xr-x 1 root other 7309 Oct 26 22:30 startup.orig*
-r-sr-xr-x 1 root sys 330836 Oct 25 04:15 su*
-rwxr-xr-x 1 root sys 1146 Oct 26 22:30 sulogin*
-rwxr-xr-x 1 root sys 10244 Oct 26 22:30 suninstall*
-rwxr--r-- 1 root sys 3156 Jan 1 1970 swapadd*
-r-xr-xr-x 1 bin bin 1180 Oct 25 04:15 sync*
-rwxr-xr-x 1 root sys 6909 Nov 2 20:45 sysconfig*
-r-xr-xr-x 1 root sys 105620 Oct 25 04:17 uadmin*
-r-xr-xr-x 1 bin bin 134932 Oct 25 04:22 umount*
-r-xr-xr-x 1 root sys 3225 Jan 1 1970 umountall*
-r-xr-xr-x 1 bin bin 110844 Oct 25 04:17 uname*

===============================================================================
Script to create the system disk dumps.
===============================================================================

tstm# cat /h/sysop/vlau/mkbit/mkbit_sol
#!/bin/csh -f

##############################################################################
# #
# File name: mkbit_sol #
# #
# Date: April 3, 1996 #
# #
# Purpose: This script backs up ALL partitions on the system disk of a #
# Solaris 2.X system. #
# #
# It first creates an ASCII TOC of all the file systems on the #
# system disk, then copies the new version of format.dat as the #
# second (tar) file on the tape before it dumps all the file #
# systems to tape. #
# #
# It tests for 8mm tape drives available on line and whether #
# a medium has been inserted into the default or user-selected #
# drive. #
# #
# WARNING: All partitions MUST BE newfs'ed even though the #
# partition(s) may not be in use. #
# #
# Format: mkbit_sol [tape drive number] #
# e.g., mkbit_sol [ 1 ] #
# #
##############################################################################

set ORIG_DIR=`pwd`
set DATE=`date | /usr/bin/awk '{printf "%s %s %s at %s",$2,$3,$6,$4}'`
set THISHOST=`/usr/ucb/hostname`
set BOOTUP_FILE=/var/adm/LastBootUp
set TAPE_DRIVE_TEST="" # test for EXB-85 tape drive(s)
set TAPE_DRIVE="" # locate the tape drive target
                                        # number, then translate it to
                                        # the format of /dev/rmt/#
set TAPE_STATUS="" # check for mounted tape
set MULTI_DRIVES="" # this variable will be set to "yes"
                                        # if multiple 8mm tape drives are
                                        # located
set MULTI_FLAG="" # this variable is used to remind
                                        # user to insert a tape into
                                        # one of the drives when no tapes
                                        # are found--expecting "good"
set MOUNTED="no" # variable to allow operator to
                                        # mount a tape in a while loop
set GET_ANSWER="" # any operator response for inserting
                                        # tape into drive
set ASCII_FILE=/tmp/sys_backup$$ # tmp ASCII file to write to tape
set FS="7 5 4 3 6 0" # file systems to be backed up
                                        # 7 (/h), 5 (/export/swap),
                                        # 4 (/export), 3 (/tmp_opt_var),
                                        # 6 (/usr), 0 (/)

# CAPTURE TAPE DRIVE PARAMETER, IF ENTERED
if ( $#argv > 0 ) then
  set TAPE_DRIVE=$argv[1]
endif

clear
echo "This program backs up all partitions (except swap) on the system disk."
echo "The partitions will be backed up in the following order:"
echo ""
foreach i ( `echo ${FS}` )
  echo -n " s$i"
end
echo ""
echo ""

# CLEAN UP TEMP FILES IF OPERATOR USES A ^C TO EXIT SCRIPT
onintr cleanup

echo -n "Waiting 30 seconds for tape to complete loading..."
sleep 30
echo ""
echo ""

echo "Checking for 8mm tape drive(s)..."

# DETERMINE TAPE DRIVE IF TAPE_DRIVE VARIABLE IS NOT SET
if ( "${TAPE_DRIVE}" == "" ) then

  # FIRST TEST IF ANY EXB-85 TAPE DRIVES ARE ON LINE (DO NOT BREAK THIS LINE
  # WITH \; OTHERWISE, VARIABLE WILL NOT BE SET)
  set TAPE_DRIVE_TEST=`/usr/bin/grep 'EXB-85' ${BOOTUP_FILE} | /usr/bin/awk
-F: '{print $1}' | uniq`

  # IF THE TAPE_DRIVE_TEST VARIABLE IS NOT EMPTY, EXB-85 DRIVE(S) HAVE BEEN
  # DETECTED
  if ( "${TAPE_DRIVE_TEST}" != "" ) then

    # CHECK HOW MANY EXB-85 TAPE DRIVES ARE ON LINE
    foreach i ( $TAPE_DRIVE_TEST )

      # GET THE TAPE DEVICE TARGET NUMBER LIKE esp@3,80000/st@4,0--YOU MUST
      # CAPTURE THE SCSI NUMBER OR YOU MAY CAPTURE TWO DIFFERENT NUMBERS
      # FROM TWO DIFFERENT SCSIs
      set TAPE_DRIVE=`/usr/bin/grep "^${i} is" ${BOOTUP_FILE} | /usr/bin/awk
-F/ '{print $5 "/" $6}'`

      # THEN, USING THE TARGET NUMBER CAPTURED, LOCATE THE LOGICAL DEVICE
      # NUMBER, LIKE 1 (AS IN /dev/rmt/1)

      # DO NOT BREAK THIS LINE WITH \; OTHERWISE, VARIABLE WILL NOT BE SET)
      set TAPE_DRIVE=`/usr/bin/ls -Fla /dev/rmt | /usr/bin/grep
"${TAPE_DRIVE}" | /usr/bin/awk '{print $9}' | /usr/bin/cut -c1 | uniq `

      # IF MULTIPLE TAPE DRIVES ARE FOUND, DISPLAY ALL DEVICES
      # FOR USER TO SELECT A TAPE DRIVE; OTHERWISE, SINGLE TAPE DRIVE IS
      # ALREADY DEFINED ABOVE
      if ( ${#TAPE_DRIVE_TEST} > 1 ) then

        # CHECK IF ANY TAPE IS INSERTED IN THE DRIVE
        ( /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} status ) >&! /dev/null

        if ( $status ) then
          # IF NO TAPE IN THIS DRIVE, DISPLAY THIS MESSAGE
          echo ".../dev/rmt/${TAPE_DRIVE} is on line but NO tape is in the
drive"
        else
          # IF TAPE IS FOUND IN THIS DRIVE, DISPLAY THIS MESSAGE
          echo ".../dev/rmt/${TAPE_DRIVE} is on line and tape is loaded in the
drive"
          set MULTI_FLAG="good"
        endif

        set MULTI_DRIVES="yes"

      endif
    end # END foreach i ( $TAPE_DRIVE_TEST )

  else

    # NO TAPE DRIVES FOUND ON LINE (dmesg DID NOT CAPTURE ANY ^st)
    echo ""
    echo "No 8mm tape drives have been found. You may need to do a"
    echo "reconfigure boot (> boot -r OR reboot -- -r) for the system"
    echo "to register your tape drive(s)."
    echo ""
    goto cleanup

  endif # END if ( "${TAPE_DRIVE_TEST}" != "" ) then

  # IF MULTIPLE TAPE DRIVES ARE FOUND, PROMPT OPERATOR FOR A TAPE DRIVE NO.
  if ( "${MULTI_DRIVES}" == "yes" ) then

    # IF NO TAPE WAS DETECTED IN MULTI-DRIVES SITUATION, REMIND USER TO
    # INSERT A TAPE IN THE TAPE DRIVE
    if ( "${MULTI_FLAG}" != "good" ) then
      echo ^G^G^G^G^G^G^G^G
      echo ""
      echo "BE SURE TO INSERT A TAPE INTO YOUR BACKUP DRIVE NOW\!\!\!"
      echo ""
    endif

    echo ""
    echo -n "Enter tape drive number (e.g., 0, 1, etc.) to be used:
/dev/rmt/"
    set TAPE_DRIVE=$<

    # CHECK FOR VALIDITY OF USER REPLY
    ( /usr/bin/ls /dev/rmt/${TAPE_DRIVE} ) >&! /dev/null

    # IF STATUS IS BAD
    if ( $status ) then
      # THE REQUESTED TAPE DRIVE IS NOT RECOGNIZED BY dmesg
      echo ""
      echo "/dev/rmt/${TAPE_DRIVE} is not a valid drive on this system."
      echo ""
      echo "You may need to do a reconfigure boot (> boot -r OR "
      echo "reboot -- -r) for the system to register your tape drive."
      echo "Exiting script..."
      echo ""
      goto cleanup
    endif
  endif # END if ( "${MULTI_DRIVES}" == "yes" )

endif # END if ( "${TAPE_DRIVE}" == "" )

# CHECK TAPE DRIVE STATUS TO SEE IF A TAPE HAS BEEN MOUNTED
while ( "${MOUNTED}" == "no" )
  ( /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} status ) >&! /dev/null

  # IF STATUS IS GOOD (0--TAPE IS MOUNTED; NON-ZERO--NOT MOUNTED)
   if ( ${status} ) then
    echo ""
    echo "Tape is not mounted in /dev/rmt/${TAPE_DRIVE}"
    echo ""
    echo "Please mount tape and make sure that it is NOT write-protected."
    echo "Wait for the tape drive light to stop flashing then press"
    echo -n "<RETURN> to continue: "

    # THIS RESPONSE IS JUST A DEVICE TO GIVE THE OPERATOR TIME TO
    # INSERT A TAPE; THE TEXTUAL PORTION OF THE RESPONSE IS IRREREVANT
    set GET_ANSWER=$<

    set MOUNTED="no"
  else
    set MOUNTED="yes"
  endif
end

# IF TAPE DRIVE IS TESTED AND READY, WRITE AN ASCII TOC AS THE FIRST FILE
# ON TAPE, THEN COPY (tar) format.dat AS THE SECOND FILE, AND ufsdump BACKUPS
# OF s7, s5, s4, s3, s6, AND s0

# CREATE THE TABLE OF CONTENTS ASCII FILE
@ FILE_COUNT = 0

foreach i ( $FS )
  @ FILE_COUNT += 1
  echo "File $FILE_COUNT - Dump of c0t3d0s${i}" >> $ASCII_FILE
end

# COPY THIS ASCII FILE TO BEGINNING OF TAPE

set MOUNTED="no"

while ( "${MOUNTED}" == "no" )
  /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} rewind

  # COPY ASCII TOC TO TAPE AS THE SECOND FILE
  echo ""
  echo -n "Copying ASCII TOC as the first file on tape..."
  cat $ASCII_FILE > /dev/rmt/${TAPE_DRIVE}n

  # IF STATUS IS NOT GOOD, TAPE MUST BE WRITE-PROTECTED
  if ( $status ) then
    ( /usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} rewoff& ) >&! /dev/null
    echo ^G^G^G^G^G
    echo ""
    echo ""
    echo "***** Tape must be write-protected *****"
    echo ""
    echo "Please wait till tape is ejected then un-protect the tape."
    echo "Wait for the tape drive light to stop flashing then press"
    echo -n "<RETURN> to continue: "
 
    # THIS RESPONSE IS JUST A DEVICE TO GIVE THE OPERATOR TIME TO
    # INSERT A TAPE; THE TEXTUAL PORTION OF THE RESPONSE IS IRREREVANT
    set GET_ANSWER=$<
 
    set MOUNTED="no"
  else
    echo ""
    set MOUNTED="yes"
  endif
end

# COPY format.dat AS THE SECOND FILE ON TAPE
echo ""
echo "Copying new version of format.dat (with 2 and 9 GB disk structures)"
  echo "as the second tar file on tape..."

  if ( -f ./format.dat ) then
    tar cvf /dev/rmt/${TAPE_DRIVE}n format.dat
  else
    echo ""
    echo "Cannot locate format.dat in `pwd`."
    echo "Exiting program..."
    goto cleanup
  endif

# DUMP ALL /dev/dsk/c0t3d0 (sd3) FILE SYSTEMS
foreach i ( $FS )
  echo ""
  echo "Dumping /dev/rdsk/c0t3d0s${i} on /dev/rmt/${TAPE_DRIVE}n"
  ufsdump 0dsbf 54000 99999 126 /dev/rmt/${TAPE_DRIVE}n /dev/rdsk/c0t3d0s$i

  # ERROR CHECKING: IF ufsdump FAILS, QUIT THE SCRIPT
  if ( $status != "0" ) then
    echo ""
    echo "DUMP FAILED. EXITING SCRIPT..."
    echo ""
    exit 1
  endif
end

cd $ORIG_DIR

/usr/bin/mt -f /dev/rmt/${TAPE_DRIVE} rewoff

cleanup:
  rm -f ${ASCII_FILE}
  exit



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:57 CDT