To resync a mirrored devices using Solstice :-
metareplace -e d6 c1t0d0s6
Where d6 is the device (not the sub-disks like d61 or d62 (which make up d6)) and c1t0d0s6 is the actual drive with errors.
Will take a while depending on the length of time the mirror has been out of sync - check with metastat.
metadb tools can also be found in
Breaking a root mirror
Breaking a root mirror to use in building another box
metadetachthe disk you wish to use in another box - mount this somewhere r/w
(following steps are to be done on the detached disk)
/etc/systemto remove all md stuff
- install boot block -
installboot /usr/platform/`/sbin/uname -i`/lib/fs/ufs/bootblk [raw-device eg /dev/rdsk/c0t0d0s0]
Bung it in another box - and voila! A working build - if you intend to mirror this disk in the new box, you will have to do the metaroot thing etc.
Adding new slices to an existing mirror
If you've got an existing mirror you can add additional slices to it then grow the filesystem over it. Even when it's mounted, woo!
If d6 is the exsting mirror consisting of d61 and d62 mounted at
/usr/local do the following
growfs will write-lock the filesystem whilst it completes but reads will be unaffected. Took about 1.5 minutes to growfs an 80gig filesystem on a v880.
Copying partition tables from one disk to another
- On the other node connected to the array: Run [@devfsadm@]
- On either node, reconfigure the DID info [@scdidadm -l c#t#d#@] then [@scdidadm -R d#@] (with the did returned from the first command)
- On the node hosting the device group,[@vxdctl enable@] then then 'replace a failed or removed disk' in vxdiskadm
Reduce quorum check for boot disks
echo "set md:mirrored_root_flag=1" >> /etc/system
This will reduce the quorum check for boot disks from >50% to >=50%. This enables the system to boot from a single disk (from a pair) without the usual metadb correction.
Replacing a disk on Sun Cluster 3
- Identify the failed drive:-
metastat -s setname
(note: if the device is 'failing' rather than 'failed' you need to detach the relevent plexes first)
- On the node hosting the device group: replace the device with luxadm:-
luxadm replace_device enclosure,position
- On the other node connected to the array:-
- On either node, reconfigure the DID info
scdidadm -l c#t#d#
scdidadm -R d#
(with the did returned from the first command)
- On any node connected to the storage, copy the partition table from the mirrored disk to the new disk:-
- On any node connected to the storage, delete and add back any broken metadbs:-
metadb -s setname metadb -s setname -d /dev/did/rdsk/replaceddisk-s7 metadb -s setname -a -c 3 /dev/did/rdsk/replaceddisk-s7
- Repair the failed mirror:-
metareplace -s setname d# -e /dev/did/rdsk/replaceddisk-s0
SVM Charting Tool
See SVM Charting Tool.
Cloning a Server
If you want to clone a server there are a number of ways of doing it:
- Break and re-sync mirrors
- Restore from backup
- Using dd over ssh over the wire
- Using tar over ssh over the wire
There are a number of gotchas with (probably) all of these methods, but here is the gotcha's for the tar method which is the best method (IMHO), especially if you have a gigabit network and the disks are different sizes/geometrys. eg. Cloning a server for Dixons and ~13GB took 38 mins.
These are the steps required:
- boot the server off the disk that usually has Solaris preinstalled
- duplicate the vtoc (we're assuming you're cloning onto c1t1d0)
- newfs all the filesystems
- mount them all up under /a
- then on your source box, run something along the lines of:
time tar cf - `\ls -A|egrep -v 'lost|proc|martini'` | ssh -x 172.22.225.69 "cd /a;tar xf -"
- when the copy has finished, you need to install the bootblock with:
installboot /a/usr/platform/`uname -m`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
- Here is the first gotcha - you need to rebuild /etc/path_to_inst or it may fail to boot with a nasty fsck error. the command to do this is:
devfsadm -p /a/etc/path_to_inst -r /a
- you then need to do a "chroot /a /usr/local/bin/bash" and remove all meta device info from /etc/system, /etc/lvm/md.cf & /etc/lvm/mddb.cf or it will kernel panic repeatedly on boot.
- the second gotcha is that when you have booted up off the clone disk and come to create the metadevices for remirroring, you usually need to run a
devfsadmfirst or the /dev/md/dsk/* and possibly the /dev/dsk/* symlinks may not exist and you'll get strange errors.
- I think that's about it. Obviously, you'll also need to change the hostname, IPs etc. Also, don't forget to configure boot-device in the OBP to boot off both disks and not net when the mirroring is complete.
- gordonj - Another gotcha is that an old /etc/mnttab might stop the server booting when you switch to the metadevices (this only seems to affect / and /usr). Just move the old /etc/mnttab out of the way before rebooting.