Sun Volume Manager, or SVM for short, allows you to do software raid in instances where you don’t have hardware capable of doing the job. You will find that the more expensive the Sun hardware gets, the less chance it will have any kind of hardware raid. So this will become a critical tool on your most critical servers. This is a quick example of how to setup mirroring of the root disk while the system is online, although it will require a reboot to finish the process.
This walk-through assumes you have two disks c0t0d0 and c0t1d0 that you want to mirror the root volume which is on slice 0. I also am assuming you have a small slice located at slice 3 on both disks for the metadevice database. Adjust the following according to your actual setup.
First you need to create the metadevice database which keeps track of your raid configuration, if you don’t already have one:
#when you initially create the database you have to force the addition of database copies
#this creates two copies of the database on the first drives slice 3
metadb -a -f -c2 c0t0d0s3
#now create the redundant copies on the second drive
metadb -a -c2 c0t1d0s3
Now that you have the database you need to configure the sub-mirrors (the volumes you are mirroring) and the metadevice which you will mount.
#run with a -f to create the stripe of the first (live) root volume
#this creates a submirror named d11 of the root volume
metainit -f d11 1 1 c0t0d0s0
#create the second submirror (the one you will be mirroring to)
metainit d12 1 1 c0t1d0s0
#now create the metadevice that you will mount
metainit d10 -m d11
You have now created the mirror, it’s time to tell the OS to use that mirror next time it comes up, this is done as follows:
At this point it’s time to reboot the system to begin using the mirror device
#flush the filesystems buffers
After the system comes up there is one final step, you told the system about d11 which d10 is a metadevice for. Currently d12 is not related to d11 or d10 in any way, you need to add d12 into the mirror
metattach d10 d12
Now you should be able to sleep easier knowing you have a redundant boot device, in a later article I will cover how to have your system boot off of the secondary device automatically in the case of a drive failure. It is important for you to record (somewhere off of the system) the devices in play so that if you have to do a recovery down the road you have the information you need. You should also keep a copy of the partition tables for good measure.