DOCUMENT ID: 1031-02 SYNOPSIS: Adding and configuring a Second Hard Drive for Solaris X86 OS RELEASE: 2.1 PRODUCT: Solaris x86 KEYWORDS: add configure Second Hard Drive disk DESCRIPTION: How to add and configure a secondary hard disk. SOLUTION: Number of steps 1 - 14 Assumptions - System was halted and turned off before connecting the disk drive. Solaris is installed on your hard disk. Must have root or superuser privileges. A Seagate 1480 435 meg disk is used as an example of a second disk to add. Your output may look different, depending on the type of disk you have. You should read through these instructions first, noting where to substitute information applicable to your system before beginning. These instructions can also be used to add additional hard disks; simply substitute the correct device name in examples that are given. Tools and utilities required - fdisk, fmthard, diskscan, addbadsec, and newfs utilities Prerequisite knowledge - Basic understanding of disks, partitions, and file systems. 1. Check that all physical connections to the disk drive are secure. Consult the documentation accompanying the disk to make sure every- thing is connected properly. Consult the Solaris 2.1 Release Manual for information about hardware configuration requirements that should be checked prior to installation. 2. Turn on power to disk drive and the system. Powering on your system causes it to read the master boot record on your system disk. This begins the boot process. o If you have more than one partition on your disk, a boot partition selection menu will be displayed. For example: Current Disk Partiton Information Part # Status Type Start Length ================================================ 1 DOS 32 63456 2 Active SOLARIS 63488 524288 3 BIGDOS 587776 69632 4Please select the partition you wish to boot: o Select the Solaris partition. If you do not make a selection, the system defaults to the active partition and tries to load boot files from there. 3. Perform a "reconfiguration boot"; type the following: > b -r (the system restarts) Follow the standard boot procedure and log in as root. From this point on, these instructions assume that a Solaris kernel has been booted from your hard disk and is running, and that you are logged in as root. 4. Run fdisk to find out information about the second disk. fdisk is used to determine the number of sectors per cylinder according to the physical geometry of the disk. The -G option provides this: #fdisk -G /dev/rdsk/c0t1d0p0 Note: The raw device name in this example refers to target 1 on the SCSI bus with device node, partition p0 representing the entire disk. o This will produce output such as: *Phys geom for device /dev/rdsk/c0t1d0p0 *PCYL NYCL ACYL BCYL NHEAD NSECT SECSIZ 1476 1464 12 0 9 64 512 The sectors per cylinder can be calculated by multiplying the number of heads (NHEAD) by the number of sectors per track (NSECT). In this example, 9 * 64 = 576 sectors/cylinder. Take note of the number of cylinders (NCYL) also, because it will be needed in future calculations. 5. Run fdisk to create a partition table on the second disk. By default, fdisk runs in interactive mode. #fdisk /dev/rdsk/c0t1d0p0 a. Select option 1 to create a new partition b. Specify 1 (a Solaris partition) c. Choose the "c" option to enter the partition in cylinders. d. Select the starting cylinder. Select 1, for example, if you choose to make the Solaris partition start at the beginning of the disk. (Solaris partitions must not begin in cylinder 0). e. Select the partition size in cylinders. This must be less than or equal to the NYCL number given in Step 4. In this example, we will assume that room was reserved for a DOS partition at the end of the disk and the Solaris partition was made a size of 1350 cylinders. f. Enter `y' to make the partition active. g. Enter 4 to write out the fdisk partition table. This also writes out a 512-byte master boot record on the first sector on the disk. o Based on our example, the fdisk partition table might now look like this: Total disk size is 1464 cylinders; Cylinder size is 576 (512 byte) blocks Partition Status Type Start End Length % ========= ====== ==== ===== === ====== == 1 Active Solaris 1 1350 1350 6. Run fmthard to get a copy of the default VTOC from the first disk. fmthard is used to create slices out of the Solaris fdisk partition created in the previous step. A volume table of contents (VTOC), sometimes called a partition map, which is part of the disk label, is written on the disk near the beginning of the Solaris fdisk partition. To tell fmthard how to divide the Solaris fdisk partition, it is easier to : a. Begin with a default partition map (like the one that exists on your first disk) b. Adjust it to suit your needs for the second disk c. Run fmthard using the new modified partition map. fmthard has a -i option that will create an ASCII representation of the VTOC on the disk. Since the second disk does not yet have a VTOC, request a copy of the one that is on the first disk (where Solaris is booted from). --------------------------------------------------------------------- CAUTION - Be sure to use the -i flag when specifying the device name for the VTOC on the disk. Since the second disk does not yet have a VTOC,request a copy of the one that is on the first disk (where Solaris is booted from). --------------------------------------------------------------------- # fmthard -i - n "" /dev/rdisk/c0t0d0s2 > tempfile This time the device name specifies target 0 (first drive) on the SCSI bus, with device node, slice s2, representing the entire Solaris fdisk partition. This will produce output suitable to be used as a template for fmthard in the file called tempfile. 7. Calculate the sizes of all slices needed for your hard disk. For a secondary disk, you will need to identify slices for the alternate sectors (ALTSCTR), the slice representing the entire Solaris partition (BACKUP), and as many user file system slices as you want. Certain slices are identified by their tag. The tag descriptions are listed in fmthard (1M) and the /usr/include/sys/vtoc.h file. Table 2-4 lists some of them. Table 2-4 Tag Identifications of Disk Slices ----------------------------------------------------------------- Partition (slice) Tag Type ================================================================= 0 2 ROOT 1 3 SWAP 2 5 BACKUP (Entire Solaris Partition) 5 1 BOOT 8 HOME 9 ALTSCTR ------------------------------------------------------------------- o In this example, we assume that you want this disk to contain one ALTSCTR slice and one additional slice for /home. The BACKUP slice must also be identified. -------------------------------------------------------------------- Note - All slices must begin on a cylinder boundary. You must determine the beginning sector and sector count for each slice. --------------------------------------------------------------------- a. Calculations for the BACKUP slice Slice 2 (tag 5, type BACKUP) should begin with sector 0 and end with the last sector on the Solaris fdisk partition. In the case of the Seagate 1480 SCSI disk, a cylinder has 576 sectors, as calculated in Step 4. Since the choice was made to use 1350 cylinders for the entire Solaris partition, the size of the whole partition in sectors can be calculated as follows: 576 sectors/cylinder * 1350 cylinders = 777600 sectors Because the beginning sector is 0 and the sector count is 776000, the ending sector is 777599. b. Calculations for the ALTSCTR slice In this example, we'll locate the alternate sectors slice (tag 9) at the beginning of the Solaris fdisk partition. However, since we may want to make this disk a bootable disk sometime in the future, we'll leave the first cylinder free, and begin at cylinder 1. Since a cylinder on a Seagate 1480 SCSI disk contains 576 sectors (NCYL), the last sector on that cylinder is 575 (the first being 0). The first sector on the ALTSCTRslice then is 576. Allow two cylinders for the ALTSCTR slice. The sector count is 2 * 576 = 1152. To calculate the last sector: sector count (1152) + first sector (576) -1 = 1727 The slice number we'll use for the ALTSCTR slice in this example is 8. c. Calculations for the /home slice Since the ALTSCTR slice ended at sector 1727, the /home slice (tag 8) should begin at 1728. The last sector is 777599. The difference between the two plus 1 = 775872. This is the sector count. The slice number we'll use for the /home slice is 7. This concludes the calculations of the slices in the Solaris fdisk partition. Based on the calculations done so far, tempfile should be modified to look like the following : ------------------------------------------------- * /dev/rdsk/c0t0d0s2 partition map * Flags * 1: unmountable * 10: read-only * * * Partition Tag Flag First Sector Sector Count 2 5 00 0 777600 7 8 00 1728 775872 8 9 01 576 1152 -------------------------------------------------- 8. Run fmthard to create VTOC and copy the two default boot programs onto you hard disk. Use the modified ASCII file that you set up in the previous step to tell fmthard how to slice up the Solaris fdisk partition. # fmthard -s tempfile -n "name" /dev/rdsk/c0t1d0s2 9. Run a surface analysis on the disk using diskscan. Specifying the -n flag causes diskscan to suppress linefeeds in its progress report. In this example, we'll specify s2 representing the entire Solaris partition on the second disk and redirect the output to a temporary file. # diskscan -n /dev/rdsk/c0t1d0s2 2>/tmp/errors 10. Run addbadsec (if needed) The diskscan utility creates a list of bad blocks. It might be necessary to edit out other error messages generated by diskscan. In addition, each transaction retry is announced to the system administrator in the form of a message on the console. The block numbers given are absolute, so the p0 device node corresponding to the target device given to diskscan should be specified. In this example, we'll assume that diskscan reported block numbers 24994 and 6\56553 as being defective. # addbadsec -a "24994 56553" /dev/rdsk/c0t1d0p0 Alternately, if a number of bad blocks were colected in the file /tmperrors, you can edit it to remove extraneous information and use it as output to addbadsec as shown below: # addbadsec -f /tmp/errors /dev/rdsk/c0t1d0p0 ----------------------------------------------------------------- Note - If the block that is defective is part of a file system structure or other special area of the disk, you may have to repartition the disk in order to use it. ----------------------------------------------------------------- 11. Run newfs to create a file system(s). Create a file system on the new disk using newfs. For example: # newfs /dev/rdsk/c0t1d0s7 This creates a file system size 775872 sectors on slice 7, as shown in the modified partition table in step 7. 12. Make a mount directory for the file system. # mkdir /home 13. Mount the file system. # mount -F ufs /dev/dsk/c0t1d0s7 /home 14. Add an entry to /etc/vfstab if you want to have the file system automatically mounted. DATE APPROVED: 11/15/95