Thursday, July 3, 2008

Adding Disks under Solaris



After Putting In New HDD Login as root.

# drvconfig ( configure the /devices directory )
# disks ( creates /dev entries for hard disks attached to the system )
# format

Once the disk has been physically installed, the system should recognize a new device on the SCSI bus. After powering up the system, hold down the Stop key (on some Suns, this is labeled L1), and hit the A key to enter the boot monitor.

At the boot monitor, probe-scsi can be used to list the SCSI devices the system recognizes:


Type 'go' to resume
Type help for more information
ok probe-scsi
.
.
Target 5
Unit 0 Disk HP C37245 5153
.
.

Note: on some older Suns, it may be necessary to enter "n" at the boot monitor to enter the newer command mode before probing for disks.

After verifying that the new disk is recognized by the system, reboot the machine by issuing "boot -r" from the boot monitor. The -r option tells the system to reconfigure for the new device.

During the boot process, the new disk should be recognized and a message should be printed to the console. (On some Suns, it may not be printed to the screen, but will be written to the system log -- in this case, the dmesg command should be used to review the boot messages). The messages should be similar to this:


sd5 at esp0: target 5 lun 0
sd5 is /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@5,0
WARNING: /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@5,0 (sd5):
corrupt label - wrong magic number
Vendor 'HP', product 'C3724S', 2354660 512 byte blocks

In this example, the disk is located on controller 0, SCSI ID 5. The "corrupt label" warning means that the disk doesn't have a Solaris label on it yet.

Device nodes

The correct device nodes for the disk are automatically added when a "boot -r" is issued. If the system hasn't been rebooted using the -r option, here is a script that will configure the system for the new disk.

Formatting, Partitioning and Labeling

The format utility is used to format, partition, and label disks. It is menu driven. The raw disk device is given as an argument; if no argument is given, format will print a list of available disks and ask the user to pick one.


# format /dev/rdsk/c0t5d0s2
selecting /dev/rdsk/c0t5d0s2
[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

Typing format at the prompt will perform a low-level format on the disk. This is usually not necessary with a new disk, since they generally come pre-formatted, but may help to map out any additional defects the drive may have developed.

The next step is to partition the drive. Type partition at the prompt to switch to the partition menu:


format> partition

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

Type in print to get a listing of the current partition table. Note that the second partition represents the entire disk:


partition> print
Current partition table (original):
Total disk cylinders available: 3361 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0-3360 1.12GB (3361/0/0) 2352700
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0


We will be splitting the disk up into two equal partitions, numbers 3 and 4. The first partition will span cylinders 0 through 1680, the second will span cylinders 1681 through 3360. The partition size can be specified in blocks, cylinders, or megabytes by using the b, c, and mb suffixes when entering the size.

partition> 3
Part Tag Flag Cylinders Size Blocks
3 unassigned wm 0 0 (0/0/0) 0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 0
Enter partition size[0b, 0c, 0.00mb]: 1680c
partition> 4
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 1681
Enter partition size[0b, 0c, 0.00mb]: 1680c

Once the disk has been partitioned, the label should be written to the disk:


partition> label
Ready to label disk, continue? y

The new partition table can be printed from the format utility, or may be viewed using the prtvtoc command:

# prtvtoc /dev/rdsk/s0t5d0s2
* /dev/rdsk/c0t5d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 140 sectors/track
* 5 tracks/cylinder
* 700 sectors/cylinder
* 3363 cylinders
* 3361 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 1176000 700 1176699
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
2 5 01 0 2352700 2352699
3 0 00 0 1176000 1175999
4 0 00 1176700 1176000 2352699

Creating new filesystems

Finally, new filesystems can be created on the disk using the newfs command, and each filesystem is checked for integrity using fsck:


# newfs /dev/rdsk/c0t5d0s3
newfs: construct a new file system /dev/rdsk/c0t5d0s3: (y/n)? y
/dev/rdsk/c0t5d0s3: 1176000 sectors in 1680 cylinders of 5 tracks, 140 sectors
574.2MB in 105 cyl groups (16 c/g, 5.47MB/g, 2624 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 11376, 22720, 34064, 45408, 56752, 68096, 79440, 89632, 100976, 112320,
123664, 135008, 146352, 157696, 169040, 179232, 190576, 201920, 213264,
224608, 235952, 247296, 258640, 268832, 280176, 291520, 302864, 314208,
325552, 336896, 348240, 358432, 369776, 381120, 392464, 403808, 415152,
426496, 437840, 448032, 459376, 470720, 482064, 493408, 504752, 516096,
527440, 537632, 548976, 560320, 571664, 583008, 594352, 605696, 617040,
627232, 638576, 649920, 661264, 672608, 683952, 695296, 706640, 716832,
728176, 739520, 750864, 762208, 773552, 784896, 796240, 806432, 817776,
829120, 840464, 851808, 863152, 874496, 885840, 896032, 907376, 918720,
930064, 941408, 952752, 964096, 975440, 985632, 996976, 1008320, 1019664,
1031008, 1042352, 1053696, 1065040, 1075232, 1086576, 1097920, 1109264,
1120608, 1131952, 1143296, 1154640, 1164832,
# fsck -y /dev/rdsk/c0t5d0s3
** /dev/rdsk/c0t5d0s3
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 9 used, 551853 free (13 frags, 68980 blocks, 0.0% fragmentation)

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home