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
Sign up for ITworld's Daily newsletter
Follow ITworld on Twitter @IT_world
Esther Schindler
If the comments are ugly, the code is ugly
claird
SVG a graphics format for 21st century
pasmith
Take Chrome OS for a test spin
Sandra Henry-Stocker
Solaris Tip: Have Your Files Changed Since Installation?
jfruh
Android fragments vs. the iPhone monolith
mikelgan
What Gizmodo missed about the Pro WX Wireless USB disk drive
Sidekick: The Good News & the Bad News
Either way you look at it Microsoft Data Center management did not follow standards or best practices in this failure. In which case it makes me wonder more about the outsourcing of corporate data much less personal data.
- mburton325
Join the conversation here
Quick, practical advice for IT pros. Made fresh daily.
Want to cash in on your IT savvy? Send your tip to tips@itworld.com. If we post it, we'll send you a $25 Amazon e-gift card.













