Mirroring A Boot Drive Using Solstice Disksuite | ||
Featured
Article on SunHelpDesk |
Solstice Disksuite is a free RAID volume manager from Sun Microsystems. This article describes the method of mirroring a boot drive using Solstice Disksuite via the command line. It is best used as an example or reference rather than a complete learning tool. This article assumes that you already have a little understanding of the basic concepts of SDS. You should read the documentation from Sun SDS 4.2.1 for more information.
Typically, environments will use SDS to mirror the boot drive of a system and use VxVM(Veritas Volume Manager) to control RAID for the application data usually residing in an external disk array(s). The idea is that SDS is easier to recover from a disaster such as boot disk failure than VxVM. However, VxVM's latest versions have made improvements in its design and have alleviated a good deal of the issues involved with disaster recovery. Proper planning and management will decrease the amount of time and complexity of recovering from a disaster if the boot drives have been encapsulated by VxVM.
Solstice Disksuite comes bundled with the Solaris 8 operating system. In previous versions, you had to purchase the server media(as opposed to workstation media) that shipped with either "Internet extensions CD(Solaris 2.6)" or the "Easy Access Server 3.0 CD(Solaris 7)".
Install Solstice Disksuite 4.2.1 on Solaris 8
Insert 2 of 2 software for Solaris 8
Change directory to the source directory
# CD /cdrom/sol_8_1000_sparc_2/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages
Install SDS. I usually install all the packages even though I do not use the GUI.
# pkgadd -d . ; type "all"; answer "y" to continue with the installation for all questions.
Reboot the server after the successful installation.
# init 6
Prepare the drives for SDS
SDS uses metadevice state databases to store information on disk about the state of your DiskSuite configuration. The metadevice state database records and tracks changes made to your configuration. These databases must reside on a dedicated slice(in the case of a boot drive). I typically leave a small amount of unused space on the boot drive when installing Solaris for these databases. That is, I leave at least one unused slice with approximately 6 MB of free space available for SDS when installing Solaris. If you do not have any unused space and you have an unused slice, then you may borrow space from swap. See documentation from Sun to perform this step.
Use format command to select the boot disk and create the slice that will hold the state database.
The output from format of my boot disk looks like the following. I have the following filesystems carved: /, swap, /var, /opt, and /export/home
Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 1392 3.13GB (1393/0/0) 6563816 1 swap wu 1393 - 3131 3.91GB (1739/0/0) 8194168 2 backup wm 0 - 7505 16.86GB (7506/0/0) 35368272 3 var wm 3132 - 4870 3.91GB (1739/0/0) 8194168 4 unassigned wm 4871 - 5740 1.95GB (870/0/0) 4099440 5 home wm 5741 - 7479 3.91GB (1739/0/0) 8194168 6 unassigned wm 0 0 (0/0/0) 0 7 unassigned wm 0 0 (0/0/0) 0Notice that slice 6 and 7 are unassigned and also there are 26 unused cylinders (7480 to 7505).
Create the dedicated slice for the state databases:
partition> 6 Part Tag Flag Cylinders Size Blocks 6 unassigned wm 7480 - 7504 57.52MB (25/0/0) 117800 Enter partition id tag[unassigned]: Enter partition permission flags[wm]: Enter new starting cyl[0]: 7480 Enter partition size[117800b, 25c, 57.52mb, 0.06gb]: 26c partition> p Current partition table (unnamed): Total disk cylinders available: 7506 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 root wm 0 - 1392 3.13GB (1393/0/0) 6563816 1 swap wu 1393 - 3131 3.91GB (1739/0/0) 8194168 2 backup wm 0 - 7505 16.86GB (7506/0/0) 35368272 3 var wm 3132 - 4870 3.91GB (1739/0/0) 8194168 4 unassigned wm 4871 - 5740 1.95GB (870/0/0) 4099440 5 home wm 5741 - 7479 3.91GB (1739/0/0) 8194168 6 unassigned wm 7480 - 7505 59.82MB (26/0/0) 122512 7 unassigned wm 0 0 (0/0/0) 0 partition> label Ready to label disk, continue? yNote: in this example the slice is 60 MB. I made this slice bigger than what is needed. This is because I intend on adding other features to this configuration at a later time and need more space. However, you should be fine with approx. 6 Mb.
The partition table of the mirrored drive should be identical to the boot drive. Simply copy the partition table of the boot drive to its mirror
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t8d0s2
fmthard: New volume table of contents now in placeIn this case c0t0d0s2 is the boot drive and c0t8d0s2 is the mirror. Notice that it is on the same controller. You should try to mirror drives across different controllers if at all possible. Basically, the fmthard command takes the partition table of the boot disk and replicates it to the mirror drive. Use the format command to verify that the partitions are exactly identical.
Configure Solstice Disksuite
Create at least 2 state database replicas on each disk. A state database replica stores DiskSuite configuration and state information. Before you can use DiskSuite, you must create state database replicas.
# metadb -a -f -c2 /dev/dsk/c0t0d0s6 /dev/dsk/c0t8d0s6
Where -a means adding; -f means force because this is the first time creating databases; and -c 2 means create 2 databases in each slice.
Create the mirror for / filesystem
Here we are creating a one-way mirror which for the time being is composed of 1 drive. Later we will attach the second drive to the mirror. The metainit command defines the metadevices that the mirror will use. The device numbers (d##) are arbitrary. I typically use 10's(1st set of submirrors), 20's(2nd set of submirrors), and 30's(mirror containing the submirrors).
# metainit -f d10 1 1 c0t0d0s0
# metainit d20 1 1 c0t8d0s0
# metainit d30 -m d10The -f means force the creation. The "1 1" means we are creating a 1 way 1 slice metadevice. "metainit d30 -m d10" creates the metadevice mirror and attaches the submirror "d10" to it.
Update the /etc/vfstab for / filesystem and /etc/system. Do not try to edit /etc/vfstab or /etc/system manually - Use the metaroot command!
# metaroot d30
Take a look at your /etc/vfstab and notice that the / filesystem will be mounted on /dev/md/dsk rather than /dev/dsk.
Create the mirror for all other filesystems
Swap filesystem:
# metainit -f d11 1 1 c0t0d0s1
# metainit d21 1 1 c0t8d0s1
# metainit d31 -m d11/var filesystem:
# metainit -f d12 1 1 c0t0d0s3
# metainit d22 1 1 c0t8d0s3
# metainit d32 -m d12/opt filesystem:
# metainit -f d13 1 1 c0t0d0s4
# metainit d23 1 1 c0t8d0s4
# metainit d33 -m d13/export/home filesystem:
# metainit -f d14 1 1 c0t0d0s5
# metainit d24 1 1 c0t8d0s5
# metainit d34 -m d14
Edit the /etc/vfstab to mount the new mirrors on boot.
The /etc/vfstab prior to updating it:
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # #/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes - fd - /dev/fd fd - no - /proc - /proc proc - no - /dev/dsk/c0t0d0s1 - - swap - no - /dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no - /dev/dsk/c0t0d0s3 /dev/rdsk/c0t0d0s3 /var ufs 1 no - /dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /export/home ufs 2 yes - /dev/dsk/c0t0d0s4 /dev/rdsk/c0t0d0s4 /opt ufs 2 yes - swap - /tmp tmpfs - yes -The /etc/vfstab after updating it:
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # #/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes - FD - /dev/fd fd - no - /proc - /proc proc - no - /dev/md/dsk/d31 - - swap - no - /dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no - /dev/md/dsk/d32 /dev/md/rdsk/d32 /var ufs 1 no - /dev/md/dsk/d34 /dev/md/rdsk/d34 /export/home ufs 2 yes - /dev/md/dsk/d33 /dev/md/rdsk/d33 /opt ufs 2 yes - swap - /tmp tmpfs - yes -Be very careful when editing this file. It is very easy to mistype something and not be able to mount that filesystem when you reboot. I suggest carefully reviewing this file before proceeding.
Suppress harmless warning messages (optional)
Typically, after a SDS install, you will receive the harmless but annoying messages on boot-up: "WARNING: forceload of misc/md_hotspares failed". This is a nuisance, so I typically suppress them by creating an empty hot spare pool:
# metainit hsp001
Reboot and allow the system to mount the mirrors.
# lockfs -fa
# init 6Ignore the following errors on boot. Suns reason for these errors: "These warnings are harmless, and may be ignored. They are an artifact of the way drivers are loaded during the boot process when you have a mirrored root or /usr file system.":
WARNING: forceload of misc/md_trans failed
WARNING: forceload of misc/md_raid failed
WARNING: forceload of misc/md_hotspares failed
Attach the second submirror to the mirror. This will cause the data from the boot disk to be synchronized with the mirrored drive.
# metattach d30 d20
# metattach d31 d21
# metattach d32 d22
# metattach d33 d23
# metattach d34 d24
Use metastat to track progress
# metastat
d30: Mirror Submirror 0: d10 State: Okay Submirror 1: d20 State: Resyncing Resync in progress: 21 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 6563816 blocks
...
Enable the mirror disk to be bootable:
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t8d0s0
# ls -l /dev/rdsk/c0t8d0s0
lrwxrwxrwx 1 root root 50 Aug 1 10:48 /dev/rdsk/c0t8d0s0 -> ../../devices/pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw
Notice the red font. This is the device path that you will use to define the alternate boot path at the ok prompt.ok nvalias mirror /pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw
NOTE: You may have to replace the "dad" with "disk" depending on the boot prom. Issue a "show-disks" at the ok prompt to verify the correct path to the disk. Use "devalias" at the ok prompt to also give clues as to which device path to use.
In case of primary boot disk failure, boot from the alternate disk
ok boot mirror