NEXTSTEP

Title: Initializing and Partitioning Large Disks 
Entry Number: 1533
Creation Date: November 7, 1995
Last Updated: <<Date June 17, 1997>>
Valid For: 3.0, 3.1, 3.2, 3.3

Keywords: initialize, partition, large, install

Question

Why am I unable to partition and initialize my new big disk?  It's a 2.7 gigabyte SEAGATE ST43400N.  I get errors like "boot block extends beyond front porch."

Answer

There's a bug in the 3.2 and older versions of BuildDisk and /usr/etc/disk when initializing large disks. Basically, they miscalculate the parameters for the partition label on the disk, and use the wrong values for creating file systems on the disk.  If you have a large disk (greater than 2 GB), you can partition and initialize the disk using the following procedure.

1	Do a low level format to make sure the drive is in the factory default state:

localhost# sdform /dev/rsd1a
device = /dev/rsd1a   block size = 512   capacity = 2777 MBytes

***FORMATTING THIS DISK CAUSES ALL DISK DATA TO BE LOST***
   This will take approximately 92 minutes.

   Do you wish to proceed? (Y/anything) Y

Disk Format in progress...
***Format Complete***

2	Run /usr/etc/scsimodes to obtain the actual disk parameters:

localhost# scsimodes /dev/rsd1a
SCSI information for /dev/rsd1a
Drive type: SEAGATE ST43400N
512 bytes per sector
99 sectors per track
21 tracks per cylinder
2737 cylinder per volume (including spare cylinders)
9 spare sectors per cylinder
21 alternate tracks per volume
5688446 usable sectors on volume

3	Create an entry in /etc/disktab for the disk:

ST43400N|ST43400N-512|SEAGATE ST43400N-512:\
        :ty=fixed_rw_scsi:nc#2737:nt#21:ns#99:ss#512:rm#3600:\
        :fp#320:bp#0:ng#0:gs#0:ga#0:ao#0:\
        :os=sdmach:z0#64:z1#192:hn=localhost:ro=a:\
        :pa#0:sa#4194304:ba#8192:fa#1024:ca#32:da#4096:ra#10:oa=time:\
                :ia:ta=4.3BSD:\
        :pb#4194304:sb#1493822:bb#8192:fb#1024:cb#32:db#4096:rb#10:ob=time:\
                :ib:tb=4.3BSD:
				
The important things to note here are where to copy the data from the scsimodes output to the disktab entry.  The items bolded above (cylinders per volume, tracks per cylinder, sectors per track, and bytes per sector) are copied from the scsimodes info.  See the disktab(5) man page for details. 

The size of the front porch (fp#) should be 320 for disks formatted with 512 byte sectors and 160 for disks formatted with 1024 byte sectors. The location (block numbers) of first level boot code (z0#, z1#) should be 64 and 192 for disks formatted with 512 byte sectors and 32 and 96 for disks formatted with 1024 byte sectors. 

The last 4 lines of the disktab entry define the partitioning of the disk.  All partitions must be less than or equal to 2*1024*1024*1024 bytes in size. The pa#0 field says partition a starts at block 0.  The sa# field indicates that it contains 4,194,304 blocks (512 bytes each, 2Gb total).  In the next set of fields, the starting point (pb#) and size (sb#) for the b partition are defined.  Note that the starting point for the b partition is the same as the starting point of the a partition plus its size (0+4194304).

If more than two partitions are required, add a line of the form:

        :pc#4194304:sc#1493822:bc#8192:fc#1024:cc#32:dc#4096:rc#10:oc=time:\
                :ic:tc=4.3BSD:
				
Make sure that the partition start and partition size fields all add up to the appropriate numbers. The sum of the sizes for all partitions (pa#, pb#, ...) and the front porch (fp#) should be less than or equal to the usable sectors on the volume.

4	Write the label (partition info) to the disk and initialize the file systems:

localhost# disk -t ST43400N -i /dev/rsd1a
disk name: ST43400N
disk type: fixed_rw_scsi
writing disk label
Writing /usr/standalone/boot
creating new filesystem on /dev/rsd1a
/usr/etc/newfs -n -v /dev/rsd1a
/etc/mkfs /dev/rsd1a 4194303 99 21 8192 1024 32 10 90 4096 t
Warning: 4096 bytes per inode impossible due
to cylinder group size, using 15620 bytes per inode
Reduce cylinder group size to reduce bytes per inode.
Warning: 748 sector(s) in last cylinder unallocated
/dev/rsd1a:     4194303 sectors in 1998 cylinders of 21 tracks, 99 sectors
        2147.5Mb in 63 cyl groups (32 c/g, 34.41Mb/g, 2048 i/g)
super-block backups (for fsck -b#) at:
 16, 33672, 67328, ...
creating new filesystem on /dev/rsd1b
...
initialization complete

5	Make an entry in /etc/fstab for the new disk like the one below.  If you do not, the first partition will mount automatically, but the remaining partitions will not be visible.  Refer to the mntent manpage for information on writhing fstab entries.

/dev/sd1a /partition1 4.3 rw,noquota 0 1
/dev/sd1b /partition2 4.3 rw,noquota 0 1
/dev/sd1c /partition3 4.3 rw,noquota 0 1