Simplification is the name of the game when it comes to disk administration. If you feel like you’re not even in the game, then it’s high time you get to know Solaris’ Solstice DiskSuite. Virtually ignored in Solaris’ installation documents, DiskSuite is a powerful disk and storage management solution that was created to meet the demands of mission-critical enterprise applications as well as Web-based organizations.
In this Daily Drill Down, I will introduce you to DiskSuite as well as provide you with a step-by-step installation guide, explain how to start up DiskSuite, and suggest some upgrading tips.
I’ll be using Solaris 8 and DiskSuite 4.2.1 on a Sparc 20 for this discussion.
There is a similar set of tools packaged under the "Solaris Volume Manager," so most of what I cover here would still apply should you move ahead to Solaris 9.
What DiskSuite does
DiskSuite is a set of tools that can perform a number of key functions, ranging from partition management to RAID. Below are the three key features of DiskSuite.
1. Manage physical disks and their data
You can combine slices (physical disk partitions) into system disks or partitions (metadevices). This works much like logical volume manager (LVM) in Linux does, giving you a great amount of flexibility to able to respond to changing needs in storage capacity. Say, for instance, you originally partitioned /usr as 1 GB, and now you find that, as you add software, /usr is at 95 percent capacity. By using DiskSuite, you can add another slice to the /usr partition to grow the partition to a more comfortable level of free space.
2. RAID volume management
This DiskSuite function allows you to set up redundant volumes for protection against hardware failure. DiskSuite allows the creation of mirrors and RAID5 metadevices. This is software RAID, and doesn't require special drive controllers, so it is a cost-effective way to achieve redundancy within a limited hardware budget.
3. Trans metadevices
This is much like the much-heralded journalized file systems that have been all the rage in Linux (reiserfs, ext3, xfs). Disk transactions on a device are logged on a logging device. This reduces system downtime after an improper reboot by decreasing the time required to fsck the device. Solaris uses the UFS filesystem, and you can enable journaling by creating trans metadevices.
Installation of DiskSuite
You can quickly see if the DiskSuite packages have already been installed by running the pkginfo | grep SUNWmd command. When I run this command, I see:
system SUNWmdb Modular Debugger
system SUNWmdbdm Modular Debugger Demo Source
The packages I am looking for are:
- · SUNWmdg
- · SUNWmdja
- · SUNWmdnr
- · SUNWmdnu
- · SUNWmdr
- · SUNWmdu
- · SUNWmdx
Since I don’t have any of the above packages, I know DiskSuite has not been installed.
To install from CD, place your Solaris 8 Software, disk 2 in your drive and run the commands shown in Listing A.
If you don't have a 64-bit Sparc, you only need SUNWmdr normal drivers. If you're running Solaris x86, of course you'll want the x86 versions of the packages. (The uname -p should have taken you to the right directory for your architecture).
In my case, I selected packages 1,3,4,5,6. Answer y to any prompts and the packages will be installed on your system. Once your selected packages are installed, pkgadd will loop back to the original list, and you'll need to type q to exit.
That's it; DiskSuite is now installed. You now have a number of new commands at your disposal. They are all located in /usr/sbin and are:
- · growfs
Use to non-destructively expand a UFS file system after adding a slice to the metadevice.
- · mdlogd
Use for solstice DiskSuite SNMP support.
- · metaclear
Use to delete active metadevices and hot spare pools.
- · metadb
Use to create and delete replicas of the metadevice state database.
(This is the first tool you'll use to begin using DiskSuite.)
- · metattach; metadetach
Use to Attach or detach metadevice to or from a mirror or trans metadevice.
- · metahs
Use to manage hot spares and hot spare pools.
- · metaini
Use to configure metadevices.
- · metaoffline, metaonline
Use to place submirrors offline and online.
- · metaparam
Use to modify parameters of metadevices.
- · metarename
Use to rename metadevice or switch layered metadevice names.
- · metareplace
Use to enable or replace components of submirrors or RAID5 metadevices.
- · metaroot
Use to setup system files for root (/) metadevice.
- · metaset
Use to configure shared disk sets.
- · metastat
Use to display status for metadevice or hot spare pool.
- · metasync
Use to handle metadevice resync during reboot.
There is also a GUI interface: metatool. Configuration of DiskSuite metadevices and slices can be done either from the command line or using the GUI.
Getting started with DiskSuite
To be able to get started with DiskSuite, you'll need some free space on all drives involved in order to create initial state databases. These initial state databases will hold the DiskSuite configuration and state information. Each drive should have two initial state databases (or three for a single drive), but they can be part of a new DiskSuite slice, rather than individual slices. You can also create a state database by disabling swap and repartitioning the swap partition into two slices, one for the swap partition and one for the state database. State databases are relatively small, only requiring about 500 KB or so.
Creating initial state database and a trans metadevice
As a quick illustration to get you started, let's enable a trans metadevice on a partition. I'll assume this is a worst-case scenario and you have no available free space to create the initial state databases, so I'll borrow from the swap partition.
To be safe, you should do this borrowing in single user mode. You should also note that this only works with swap. Using other active partitions will result in data loss. As with all activities of this sort, you should have recent backups in the event that things don't work out as expected.
Although this system has multiple disks, I'll show the steps as if there was only one, creating three initial state databases on the one disk. The first step is to locate and disable your swap as shown in Listing B.
Now it’s time to move on to partitioning. I want to shrink the swap partition on slice 1 and use the gained space for our initial state database as shown in Listing C.
Now I need to re-enable swap, as shown in Listing D.
Double-check the existence of your new slice for the metadb, as shown in Listing E.
Now create the three initial state databases as shown in Listing F.
You could have gotten by with a little less space for the initial state databases, but you only gave up 4 MB of your swap, so the sacrifice wasn't much. Now you've got swap back on, your initial state databases are up and running, and you're ready to create a trans metadevice. You should note that any UFS filesystem, except root (/), can be logged. For this example let’s use /export/home with the following contents:
# umount /export/home
# metainit -f d20 -t c0t3d0s7 c0t3d0s3
d20: Trans is setup
The c0t3d0s7 entry is our /export/home slice and c0t3d0s3 is the slice containing the initial state databases. Now edit /etc/vfstab to point to the trans metadevice rather than the actual disk slice. Listing G shows the changes necessary for the /etc/vfstab.
That's it; you now have a trans metadevice for the /export/home partition. On reboot, instead of an fsck on the device, you'll see something like:
/dev/md/rdsk/d20: is logging
You can also use the metastat command to see the status of your metadevices.
Notes on upgrading from previous versions
If you are upgrading from a previous version of Solaris and DiskSuite, you need to take a number of steps to prepare for the upgrade.
- · Backup all filesystems. (This is generally a good idea before an upgrade, anyway.)
- · Repair any mirrors that have errors.
- · Back up all metadevice configuration data to floppy (or another machine) with the commands shown in Listing H.
- · Clear any trans metadevices that may be used during the upgrade (/, /usr, /var).
- · Edit /etc/vfstab and comment out any filesystems that are mounted on metadevices that aren't simple metadevices or mirrors.
- · Use metadetach to convert the remaining simple mirrors to one-way mirrors.
- · Use metaroot to remount / to the underlying component of the metadevice.
- · Remount the remaining filesystems on their underlying components and edit vfstab accordingly.
- · Remove the symbolic links to the DiskSuite init scripts (/etc/rc2.d/S95lvm.sync and /etc/rcS.d/S35lvm.init) so DiskSuite is not started at boot.
- · Halt the machine and then do the Solaris upgrade.
- · Install DiskSuite after rebooting, and reverse the steps above to re-create your metadevice setup.
Get ready for mirroring and RAID
This should give you an excellent start with DiskSuite. Read up on the documentation, including the man pages, and, in my next article, I will go through the steps involved in creating a mirrored setup for an existing installation, as well as creating a RAID5 metadevice. You should be aware that you'll need at least three physical disks to use RAID5.