Solaris Volume Manager Tips

From Docupedia

Written By: Steve Ayotte

Date: 4/27/2007

Overview

This article covers some tips I could have used when I ran into troubles with Solaris Volume Manager (SVM).
I will continue to add to it as I am forced to find solutions to annoying issues that aren't immediately apparent from reading the main documents.

Fixing a broken SVM config after removing/moving disks

Solaris likes to renumber its devices when you do a 'boot -r', which can be problematic for a volume manager since it expects to find the data at the same address it left it before a reboot. SVM is supposed to address this by tracking device signatures in its state databases, but it keeps track of where it's keeping the state databases by device number. When you move the disk a state database is on, that state database too becomes inaccessible. If fewer than 50% of the original number of databases are available after your machinations, the system will try to sort things out for itself and ungracefully just sit at the transition from single- to multi-user mode.

This can be caused by removing unneeded disks as well, if they aren't replaced with other ones (i.e. hot-swapping does not cause this issue). It always follows a boot -r, so you could conceivably avoid it by never performing one, but since it might be unavoidable in the future it's better to just get it over with immediately after moving/removing disks.

This is done by deleting the state databases on those disks, and then re-adding them. This will need to be done in single-user mode. The steps are as follows (assuming I've moved the disk that used to be at c0t5d0 to c1t0d0, and I always keep my databases on s7):

  metadb -d -f c1t0d0s7
  metadb -a -c 1 c1t0d0s7

Using SVM for a mirrored root partition

metainit -f d10 c0t0d0s0
metainit d20 c1t0d0s0
metainit d0 -m d10
metaroot d0
ls -l /dev/dsk/c0t0d0s0
ls -l /dev/dsk/c1t0d0s0
shutdown -g0 -i0 -y
devalias rootdisk (device for c0t0d0s0)
devalias mirrdisk (device for c1t0d0s0)
setenv boot-dev rootdisk mirrdisk
boot
metattach d0 d20
while (metastat d0 | grep -i Resync); do sleep 1; clear; done

Sayotte 14:59, 27 April 2007 (EDT)