Setting Up RAID Volumes with Solaris Volume Manager, Part 2
In last week's column, we examined the process of setting up RAID volumes on a Solaris 9 server. The process is surprisingly straightforward when there are no file systems on the target disks or partitions. When file systems occupy the target space, they have to be backed up and then reloaded for RAID 5. For mirrored volumes, on the other hand, you can set up your volume in such a way as to preserve the initial partition's contents. In this column, we'll look at how these things are done.
RAID 5 for File Systems
Let's says that we want to turn the /var partition on our new Solaris 9 server into a RAID 5 volume. One way to back up its contents is to use a ufsdump command to copy the file system to another location on the disk. A command such as this will copy /var quite expediently (you need to create /var-bkp first):
# ufsdump 0f - /dev/rdsk/c0t0d0s5 | (cd /var-bkp/; ufsrestore xf -)
The 0f argument in this command specifies that we want a full dump and that we will specify the device that we are writing to. The - argument says that we're not really writing to a device at all; instead we are going to pipe the dump output to another command. The /dev/rdsk/c0t0d0s5 argument is, of course, our /var partition.
On the right side of the pipe, we have grouped two commands -- one to move into the /var-bkp directory and another to extract the contents from the dump. When this command completes, /var-bkp looks the same as /var.
Since the system won't allow us to unmount /var, we'll just make some changes to /etc/vfstab and reboot the system to use the backup as /var. To do this, we first comment out the mount line for /var from /etc/vfstab. Then, we move /var to /var-orig (to get the mount out of the way), move /var-bkp to /var and reboot:
# mv /var /var-orig # mv /var-bkp /var # reboot
At this point, /var is simply a subdirectory in root and partition 5 is not mounted. We can, therefore, proceed with our construction of the new RAID 5 volume using a metainit command such as this:
# metainit d5 -r c0t0d0s5 c0t1d0s5 c0t2d0s5d5: RAID is setup
Again, metainit has not completed the configuration of the volume when it spits out "RAID is setup". It will take a while longer and we can use the metastat command to watch its progress. The new volume will be ready when the state is "Okay":
# metastat | grep State
State: Okay
Once the RAID volume is ready, we can build a new file system with newfs, mount the volume on a temporary mount and then copy the contents of /var-bkp (now /var) back to what will become the new /var. The newfs and mount commands will look like this:
# newfs /dev/md/rdsk/d5 # mkdir /var-new # mount /dev/md/dsk/d5 /var-new
We then have some choices on how to copy the original contents of
Essential JavaFX
Get started building rich Web apps quickly with an introduction to the power of JavaFX key features -- scene node graphs, nodes as components, the coordinate system, layout options, colors and gradients, custom classes with inheritance, animation, binding, and event handlers.Enter now!
The Nomadic Developer
Consulting can be hugely rewarding, but it's easy to fail if you are unprepared. To succeed, you need a mentor who knows the lay of the land. Aaron Erickson is your mentor, and this is your guidebook. Enter now!












