SVM

The Solaris volume manager (SVM) is a free component of  Solaris 9 and Solaris 10. It was previously known as Solstice DiskSuite. SVM software provides mechanisms to configure physical slices of harddrive into logical volumes. As such it introduces additional level of complexity and should not be used unless absolutely necessary. On Solaris 10 using ZFS is a better alternative. Logical volumes can be configured to provide mirroring and RAID5.  In its simplest form SVM uses traditional Solaris disk partitioning (up to eight partitions or slices in Solaris terminology) to build virtual disks called volumes.

Any partition can be used to create volumes, but it is common practice to reserve slice s7 for the state database replicas. Database replicas are created on selected disks and hold the SVM configuration data. It is the administrator’s responsibility to create these state databases (using the metadb command) and distribute them across disks and controllers to avoid any single points of failure

The version of SVM shipped with Solaris 9 has several new features: soft partitions, monitoring active disks, access via SMC.

The soft partitioning feature allows to subdivide a disk into many small slices that are controlled and maintained by software (hence the term soft partitioning). Soft partitioning allows up to 8192 partitions on a single drive or volume, providing greater flexibility as with today’s 500G disks, customers often need to subdivide a disk into more then 8 partitions. Solaris Volume Manager enables an administrator to create soft partitions either on top of individual physical disks, or on existing hardware RAID 1, RAID 5, or RAID 0 volumes.

All mirrored volumes in SVM automatically benefit from volume logging. Volume logging limits the amount of block copy activity necessary to keep the mirrored volumes in sync. Volume logging uses bitmaps held in the state databases to track changes to submirrors. Consequently, all mirrored volumes are protected against the need to perform a full-mirror resynchronization in the event of a system failure.

Location of components
———————-

for Solstice DiskSuite 4.x:
command line utilities in /usr/opt/SUNWmd/sbin
driver modules in /kernel/drv and /kernel/misc
daemons in /usr/opt/SUNWmd/sbin
administrative files in /etc/opt/SUNWmd
the packages are SUNWmd and SUNWmdg (the GUI)
for Solaris Volume Manager 1.0:
command line utilities in /usr/sbin
driver modules in /kernel/drv and /kernel/misc
daemons in /usr/sbin
administrative files in /etc/lvm
The GUI is integrated in the Solaris[TM] Management Console of Solaris 9.
metadevices are named /dev/md/{dsk|rdsk}/dn, with n from 0 to 127 by default

Useful options
————–

The -f option can be used with most commands to force the operation. This is
needed when doing an operation on a mounted filesystem.

md.tab file
———–

The /etc/opt/SUNWmd/md.tab (etc/lvm/md.tab) file can be used to configure Solstice DiskSuite automatically.

# metastat -p >

This will output your configuration in md.tab format

# metainit -a

This command reads the md.tab file and sets up the configuration accordingly
Creating replicas
—————–

# metadb -a -f -c 3 c0t3d0s7

Before you can use Solstice DiskSuite software, you must create the metadevice state database. The replica can exist on a dedicated disk partition or within a concat, stripe, or logging metadevice.

There MUST be 3 replicas or Disksuite S/W cannot be used correctly.See Documentation for more info on replicas.it modifies the following files

Solstice DiskSuite 4.x: /etc/system, /etc/opt/SUNWmd/mddb.cf
Solaris Volume Manager: /etc/lvm/mddb.cf /kernel/drv/md.conf

you can also modify the md.tab file to create a configuration
Creating metadb from scratch in a new setup

(*may need to force some options)

# metadb -a -f c#t#d#s# *mounted filesystem
Adding more replicas (Note that you cannot create addional replicas on same device once initial replias have been created)
# metadb -a c#t#d#s#

# metadb -a -f c#t#d#s#
Deleting replicas

# metadb -d c#t#d#s#

# metadb -a -f c#t#d#s# * if less than 3
checking replicas

remove/recreate replicas with upper case flags to patch replica in kernel

# metadb -p c#t#d#s#
Concatenation
————-

# metainit d1 3 1 c0t1d0s2 1 c1t1d0s2 1 c2t1d0s2

where d1 is the metadevice, 3 is the number of components to concatenate and 1 is the number of component/slices per device
Simple Stripe
————-

# metainit d2 1 3 c0t1d0s2 c1t1d0s2 c2t1d0s2 -i 16k

where d2 is the metadevice, 1 is the number of components to concatenate and 3 is the number of slices to stripe across
-i 16k indicates the amount of data to write to each disk in stripe before moving to next one
Concat/Stripe
————-

# metainit d3 3 3 c0t1d0s2 c1t1d0s2 c2t1d0s2 -i 16k 3 c3t1d0s2 c4t1d0s2 c5t1d0s2 -i 16k 3 c6t1d0s2 c7t1d0s2 c8t1d0s2 -i 16k

Here there are three stripes concatenated together. d3 is the metadevice.
The first 3 is the number of components to concatenate.
The second and subsequent 3’s indicate the number of slices to stripe across. The options there are as in the simple stripe.
Extending a metadevice
———————-

# metattach d1 c3t1d0s2

extends a metadevice by concatenating a slice to the end. It does not add a filesystem.

# growfs /dev/md/rdsk/d1

If the metadevice is not mounted, the above command extends the filesystem to include the added section. You cannot shrink this filesystem later.

# growfs -M /export/home /dev/md/rdsk/d1

If the metadevice is mounted, the above command will extend the filesystem to include the concatenated section. Again, you cannot shrink the
filesystem later.
Removing a metadevice
———————

# metaclear d3

d3 is the metadevice.

# metaclear -a -f

clears all metadevices. Don’t do this unless you want to blow away your entire
configuration.

The devices cannot be open for use.., i.e. mounted

Viewing your configuration and status
————————————-

# metastat

shows the configuration and status of all metadevices

# metastat d3

will tell the configuration and status of just metadevice d3

# metadb

tells the location and status of locally configured replicas
Note that: these commands displays the configuration on the local filesystems and not on the disksets.
Hot Spare pools
—————

# metainit hsp001

sets up a pool called hsp001. It contains no disks yet.

# metahs -a hsp001 c0t1d0s4

adds a slice to the hot spare pool. NOTE: it is advisable to add disks/slices
to the pool in order of smallest to largest. This way the smallest
hotspare capable of replacing a disk will be selected when needed.

# metahs -a all c1t1d0s4

adds a slice to all pools
# metaparam -h hsp001 d1

makes a hot spare pool available to the metadevice d1 {submirror or RAID5}
# metahs -e c1t1d0s4

reenables a hot spare that was previously unavailable

# metahs -r hsp001 c1t1d0s4 c2t1d0s4

replaces the first disk slice listed with the second

# metahs -d all c1t1d0s4

removes a disk slice from all hot spare pools

# metahs -d hsp001 c1t1d0s4

removes a disk slice from hsp001

# metahs -d hsp001

removes a hot spare pool

# metahs -i
# metastat

Reports the Disksuite/LVM status
Mirrors
——-

# metainit d0 -m d1

makes a one-way mirror. d0 is the device to mount, but d1 is the only one
associated with an actual device. A “one-way mirror” is not really
a mirror yet. There’s only one place where the data is actually
stored, namely d1.

# metattach d0 d2

attaches d2 to the d0 mirror. Now there are 2 places where the data are
stored, d1 and d2. But you mount the metadevice d0.

# metadetach d0 d1

detaches d1 from the d0 mirror

# metaoffline d0 d2
# metaonline d0 d2

suspends/resumes use of d2 device on d0 mirror

# metareplace d0 c1t0d0s2 c4t1d0s2

replaces first disk listed with second on the d0 mirror

# metareplace -e d0 c1t1d0s2

re-enables a disk that has been errored.
Mirroring root
————–

You must take a few extra steps to mirror the root partition

# metainit -f d1 1 1 c0t3d0s0 <– the root partition
# metainit d0 -m d1
# metaroot d0

the metaroot command updates /etc/system and /etc/vfstab so that the device /dev/md/dsk/d0 is now the root device.
Note: It is recommended to take a copy of the /etc/system and /etc/vfstab before running metaroot command or making any change in these files.

For Solstice DiskSuite versions 4.1 or greater and Solaris 9 LVM it is necessary to lock filesystems before rebooting, so run

# lockfs -fa
# reboot

you must reboot with a one-way mirror : do not create a 2 way mirror before rebooting otherwise the system
will crash because of the round robin manner in which data is read.

# metainit d2 1 1 c0t4d0s0
# metattach d0 d2

Now d2 is attached and data is mirrored on d1 and d2.

Note : this procedure mirrors only /, if you want to mirror the whole system disk, do not forget to mirror the swap slice and all other slices where a file system is installed using the above procedure of creating submirrors and mirrors.

In this case, remember that metaroot command only modify / in vfstab, so you have to manually edit other system disk entries in /etc/vfstab to put metadevice paths before rebooting.
Raid 5

——

# metainit d1 -r c0t1d0s2 c1t1d0s2 c2t1d0s2 -i 16k

sets up a RAID 5 configuration.
The -i option is the same as in striping.

# metareplace d1 c2t3d0s2 c3t1d0s2
# metareplace -e d1 c0t1d0s2

replacing disks as in the mirror.

# metattach d1 c4t3d0s2

concatenates a disk to the end of the RAID 5 configuration.

# metaparam -h hsp001 d1

adds a hot spare pool

# metaclear d1

removes a metadevice

# metastat

tells status
UFS logging
———–

# metainit d0 -t d1 d2

sets up a trans device d0 with d1 as the master and d2 as the logging device.
recommended 1MB logging/1GB data on master

# metainit d0 -t c0t1d0s2 c3t2d0s5

same as above

# metattach d0 d1
# metattach d0 c3t1d0s5
# metadetach d0

attaching and detaching a log device on/from d0

Disksets
——–

# command -s options

you can do almost everything the same way, except specify -s

metadevices in shared diskset are called
/dev/md//{dsk|rdsk}/dn

hot spare pools within a shared diskset are named
/hspnnn

Disks are repartitioned when put into a diskset unless slice 2 is zeroed out and slice 7 has cylinders 0-4 or 0-5 allocated to it for the diskset metadb

# metaset -s -a -h

adds hosts to a set

# metaset -s -a c2t0d0 c2t1d0 c2t2d0 c2t3d0

adds drives to a set. Notice we do not specify slice.

# metaset -s -d c2t3d0
# metaset -s -d -h

removes hosts and drives

# metaset -s -t

take control of a diskset. the -f option will force control but will panic
other machine, unless it has been released from other host.

# metaset -s -r

releases control of a diskset
Troubleshooting info to gather
——————————

output from following…

# metastat
# metadb -i
# prtvtoc on relevant devices
# mount
# /var/adm/messages if relevant
Note that this info is ok if the problem on the local hosts but if it relates to disksets you may need to gather the output of

# metastat -s <diskset>