Содержащиеся в
Найти другие документы
Ресурсы поддержки
| Загрузить это руководство в формате PDF
x86: Additional Disk Commands
B
- This appendix describes how to set up a disk connected to an x86 system using the following commands:
-
-
fdisk
-
fmthard
-
diskscan
-
addbadsec
x86 Setting Up Disks Using Additional Disk Commands
- This section includes step-by-step instructions for performing tasks related to manually setting up disks using the disk command line interface.
- You will find an example of the screen input and output associated with the task with each set of instructions. Your screen output will vary based on your system configuration.
-
x86 How to Add a Secondary Disk
- The following steps are used to set up a disk using the command line interface:
-
- Physically connecting the disk device to the system
- Performing a reconfiguration boot
- Creating the Solaris fdisk partition with the fdisk command
- Dividing the disk into slices using the fmthard command
- Running surface analysis with the diskscan command
- Remapping bad sectors using the addbadsec command, if necessary
-
-
Run the fdisk command to display the geometry of the second disk. Use the fdisk command with the -G option to determine the number of sectors per cylinder according to the physical geometry of the disk:
-
# fdisk -G /dev/rdsk/c0t1d0p0
|
-
x86 - The raw device name in this example refers to target 1 on the SCSI bus, with device node, partition p0, representing the entire disk.
- The following output is produced:
-
* Physical geometry 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.
-
-
Run the fdisk command to create a partition table on the second disk. By default, the fdisk command 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 1. In this example, 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.
- Based on the example, the fdisk partition table might now look like this:
-
Total disk size is 1464 cylinders
Cylinder size is 576 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ======== ===== === ====== ===
1 Active Solaris 1 1350 1350
|
-
-
Run the fmthard command to get a copy of the default VTOC from the system disk.
The fmthard command 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 system disk).
b. Adjust it to suit your needs for the second disk.
c. Run the fmthard command using the new modified partition map. The fmthard command has a -i option that creates 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 system disk (where Solaris is booted from).
-
Caution - Be sure to use the -i flag when specifying the device name for the primary (boot) disk. Failure to do so will cause the fmthard command to overwrite the VTOC on your primary disk, and you will have to reinstall Solaris.
-
# fmthard -i -n "" /dev/rdsk/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 produces output suitable to be used as a template for the fmthard command in the file called tempfile.
-
-
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 slice (ALTSCTR), the slice representing the entire Solaris partition (BACKUP), and as many user file system slices as you want. In this example, assume that you want this disk to contain one ALTSCTR slice and one additional slice for /export/home. The BACKUP slice must also be identified.
-
x86 - 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 1. 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, locate the alternate sectors slice (tag 9) at the beginning of the Solaris fdisk partition. However, since you may want to make this disk a bootable disk sometime in the future, 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 ALTSCTR slice 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 /export/home slice Since the ALTSCTR slice ended at sector 1727, the /export/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 /export/home slice is 7.
- This concludes the calculation 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
|
-
-
Run the fmthard command to create the VTOC and copy the two default boot programs onto your 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
|
-
-
Run a surface analysis on the disk using the diskscan command. Specifying the -n flag causes diskscan to suppress linefeeds in its progress reports. See diskscan(1M). In this example, 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
|
-
-
Run the addbadsec command (if needed).
The diskscan command 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, assume that diskscan reported block numbers 24994 and 56553 as being defective.
-
# addbadsec -a "24994 56553" /dev/rdsk/c0t1d0p0
|
- Alternatively, if a number of bad blocks were collected in the file /tmp/errors, you can edit it to remove extraneous information and use it as input 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.
-
-
Run the newfs command to create a file system(s). Create a file system on the new disk. (See newfs(1M).) For example:
-
# newfs /dev/rdsk/c0t1d0s7
|
- This creates a file system of size 775872 sectors on slice 7, as shown in the modified partition table example on page 86.
-
-
Make a mount directory for the file system.
For example:
-
-
-
Mount the file system.
For example:
-
# mount -F ufs /dev/dsk/c0t1d0s7 /export/home
|
-
-
Add an entry to the /etc/vfstab file if you want to have the file system automatically mounted. See vfstab(4).
|
|