|
|
Topic 1, Software RAID via DiskSuite:
Almost none of the medium-low range SUN
servers support hardware RAID.
For this purpose, Solaris provides a dodgy suite of software RAID tools called
'Disksuite'.
In Disksuite, a 2-way mirror is a metadevice, itself made up of two sub mirror
metadevices. A metadevice can be made out of an existing slice --
non-destructively, unlike some other software-RAID tools out there. The
technique is to create metadevices out of the existing slices, create the
companion metadevices out of the spare slices, and join these together to form
the 2-way mirrors that will be mounted instead of the raw disk slices. The 2-way
mirror metadevices are actually first created as 1-way, with the second disk
attached afterward.
Metadatabases must be present on three separate drives to satisfy the DiskSuite
'majority concensus' fallover algorithm.
testbox# pkgadd -d
/cdrom/cdrom0/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages \
SUNWmdr SUNWmdx SUNWmdu SUNWmdg
Then reboot:
testbox# shutdown -y -g0 -i6
Disksuite Configuration for Solaris 8
Example layout for system disk (see /etc/vfstab):
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c1t2d0s0 - - swap - no -
/dev/dsk/c1t2d0s1 /dev/rdsk/c1t2d0s1 / ufs 2 yes -
/dev/dsk/c1t2d0s3 /dev/rdsk/c1t2d0s3 /opt ufs 2 yes -
/dev/dsk/c1t2d0s4 /dev/rdsk/c1t2d0s4 /install ufs 2 yes -
/dev/dsk/c1t2d0s5 /dev/rdsk/c1t2d0s5 /backup ufs 2 yes -
swap - /tmp tmpfs - yes -
6.2.1 Concepts and Initial steps
All steps listed as part of this procedure must be performed as root user.
6.2.1.1 System Backup
Backup /etc/vfstab to /etc/vfstab.<date> before beginning this procedure.
The SOA system should be completely backed up before DiskSuite Configuration can
begin. See the IT department tto verify that this has been done within the last
24 hours.
You need to duplicate the layout from disk2 to disk1. It's important that the
disk geometry matches. Metadevices work at the block-level of the disk, and if
one disk has fewer blocks than the other you'll wind up making a mess. Once
you're sure you're ready to proceed, dump the layout from disk0 to disk1 thusly:
prtvtoc /dev/rdsk/c1t2d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2 (s2 being the
virtual ‘backup’ slice)
This can also be done in the Solaris Management Console as a right-click option
of the primary disk. See the SMC documentation.
NOTICE: AT LEAST TWO UNASSIGNED SLICES RESERVED ON EACH DISK!
A minimum of two metadatabases must be on each system disk, preferably spread
over more than one disk slice. They only need to be 9MB or so - a minimum
allocation of 2 cylinder should do.
In our SOA, Unallocated Slices 6 and 7 of each disk will hold the meta
databases:
testbox# metadb -a -f c1t2d0s6 c1t2d0s7 c1t1d0s6 c1t1d0s7 c1t0d0s6 c1t0d0s7
NOTE: Metadatabases must be present on three separate drives to satisfy the
DiskSuite 'majority concensus' fallover algorithm.
6.2.2 Mirroring the Root Disk
Create a metadevice out of the original root:
testbox# metainit -f d10 1 1 c1t2d0s1
Create a metadevice for the root mirror:
testbox# metainit d20 1 1 c1t1d0s1
Set up a one-way mirror of the root metadevice:
testbox# metainit d0 -m d10
Configure the system to boot the root filesystem from the metadevice, using the
"metaroot" command. This will make the necessary changes to /etc/vfstab and
/etc/system:
testbox# metaroot d0
Flush any UFS logging of the master filesystem:
testbox# lockfs -fa
Reboot:
testbox# shutdown -y -g0 -i6
(or 'init 6')
Attach the second metadevice to the root metadevice to make it a 2-way mirror:
testbox# metattach d0 d20
The RAID will sync the mirror disk to the primary. Wait until disk activity
stops.
Get the name of what is now the raw root disk, in case we need it later (in
openboot):
testbox# ls -l /dev/rdsk/c0t1d0s0
You'll need to install the bootsector to your second disk so that you can boot
from it:
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s1
You might also want to set the OBP to boot from disk1 if it can't boot from
disk0. If you bring the machine to the OBP (ok) prompt via init 0, you can enter
the following:
setenv boot-device disk2:b disk1:b net
nvstore
boot
Optional test:
boot disk1:b (or, disk1:b if on bootblk on /dev/rdsk/c0t1d0s1, etc)
...This will set up a failover boot to disk1. The very last command there will
also boot from disk1, proving to you that this works. Be sure to type the actual
disk:slice for "disk1:b".
6.2.3 Mirroring the Remaining Slices
Create a metadevice from the original /opt partition (see /etc/vfstab for
correct slice):
testbox# metainit -f d13 1 1 c1t2d0s3
Create a metadevice from the mirror /opt partition:
testbox# metainit -f d23 1 1 c1t1d0s3
Create the /opt mirror metadevice as a one-way mirror of the /opt metadevice:
testbox# metainit d3 -m d13
Create metadevices for the /install mirror if on separate slices:
testbox# metainit -f d14 1 1 c1t2d0s4
testbox# metainit -f d24 1 1 c1t1d0s4
Create a mirror metadevice for /install:
testbox# metainit d4 -m d14
Create metadevices for the /backup mirror if on separate slices:
testbox# metainit -f d15 1 1 c1t2d0s5
testbox# metainit -f d25 1 1 c1t1d0s5
Create a mirror metadevice for /backup:
testbox# metainit d5 -m d15
Edit /etc/vfstab so that the new metadevices will be mounted (comment out old
entries):
/dev/md/dsk/d3 /dev/md/rdsk/d3 /opt ufs 1 no logging
/dev/md/dsk/d4 /dev/md/rdsk/d4 /install ufs 1 no logging
/dev/md/dsk/d5 /dev/md/rdsk/d5 /backup ufs 1 no logging
Open /etc/vfstab again and look at it carefuly. A corrupt vfstab will prevent
booting!
Reboot again:
testbox# shutdown -y -g0 -i6
Finally, Attach the second submirrors to the mirrors to make 2-way mirrors:
testbox# metattach d3 d23
testbox# metattach d4 d24
testbox# metattach d5 d25
Wait until disk activity stops before doing much else. DiskSuite's progress of
syncing the second drive to the first can be monitored using the "metastat"
command. Though it is not strictly necessary, it is a good idea to reboot after
this, if only to make sure there are no problems and that the box will indeed
come back up.
6.3 Final Results
Example /etc/vfstab after RAID:
#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/c1t2d0s0 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
#/dev/dsk/c1t2d0s3 /dev/rdsk/c1t2d0s3 /opt ufs 2 yes -
/dev/md/dsk/d3 /dev/md/rdsk/d3 /opt ufs 1 yes logging
#/dev/dsk/c1t2d0s4 /dev/rdsk/c1t2d0s4 /install ufs 2 yes -
/dev/md/dsk/d4 /dev/md/rdsk/d4 /install ufs 1 yes logging
#/dev/dsk/c1t2d0s5 /dev/rdsk/c1t2d0s5 /backup ufs 2 yes -
/dev/md/dsk/d5 /dev/md/rdsk/d5 /backup ufs 1 yes logging
swap - /tmp tmpfs - yes -
Results of ‘metastat’ command’:
[testbox]/ # metastat
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 20484288 blocks
d10: Submirror of d0
State: Okay
Size: 20484288 blocks
Stripe 0:
Device Start Block Dbase State Hot Spare
c1t2d0s1 0 No Okay
d20: Submirror of d0
State: Okay
Size: 20484288 blocks
Stripe 0:
Device Start Block Dbase State Hot Spare
c1t1d0s1 0 No Okay
d3: Mirror
Submirror 0: d13
State: Okay
Submirror 1: d23
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 24585216 blocks
d13: Submirror of d3
State: Okay
Size: 24585216 blocks
Stripe 0:
Device Start Block Dbase State Hot Spare
c1t2d0s3 0 No Okay
d23: Submirror of d3
State: Okay
Size: 24585216 blocks
Stripe 0:
Device Start Block Dbase State Hot Spare
c1t1d0s3 0 No Okay
…etc
|