Repair Solaris SVM Metadevices

This document describes the process to replace a1. Remove the failed drive from the system
disk, which is controlled by Solaris Volume Managerconfiguration. Use cfgadm --al to identify the disk
(SVM) DiskSuite Metadevice, and is a part of a mirrorcontroller and associated devices.
configuration.# cfgadm -al
1. Run "metastat" to identify the failed metadevice.Ap_Id Type Receptacle Occupant Conditionc0
1. metastatd0: Mirrorscsi-bus connected configured unknownc0::dsk
Submirror 0: d1c0t0d0 CD-ROM connected configured unknownc1
State: Okayscsi-bus connected configured unknownc1::dsk/c1t0d0
Submirror 1: d2disk connected configured unknownc1::dsk/c1t1d0 disk
State: Needs maintenanceconnected configured unknownc1::dsk/c1t2d0 disk
Pass: 1connected configured unknownc1::dsk/c1t3d0 disk
Read option: roundrobin (default)connected configured unknownc2 scsi-bus connected
Write option: parallel (default)unconfigured unknown
Size: 2101552 blocksd1: Submirror of d0Use cfgadm --c to unconfigure and remove the failed
State: Okaydevice from the system.
Size: 2101552 blocks1. cfgadm -c unconfigure c1::dsk/c1t1d0
Stripe 0:2. Turn the server over to Open System Ops/SUN
Device Start Block Dbase State Hot Sparec1t0d0s0 0to replace the failed drive.
No Okayd2: Submirror of d0 
State: Needs maintenance1. Once the drive is replaced, run cfgadm --c to
Invoke: metareplace d0 c1t1d0s0 <new device>reconfigure the new disk
Size: 2101552 blocks1. cfgadm -c configure c1::dsk/c1t1d0
Stripe 0:2. Use "prtvtoc/fmthard" to create partitions to
Device Start Block Dbase State Hot Sparec1t1d0s0 0match the original drive.
No Maintenance1. prtvtoc /dev/rdsk/c1t0d0s2 > /var/tmp/disk
2. Run "metastat --p" to identify all the metadevices2. fmthard -s /var/tmp/disk /dev/rdsk/c1t1d0s2
that are associated with the failing device3. Use "metainit" to recreate the submirrors
1. metastat --pd0 -m d1 d2 1d1 1 1 c1t0d0s0d2 1 11. metainit d2 1 1 c1t1d0s0d2: Concat/Stripe is setup
c1t1d0s0d10 -m d11 d12 1d11 1 1 c1t0d0s1d12 1 12. metainit d12 1 1 c1t1d0s1d12: Concat/Stripe is setup
c1t1d0s1d3 1 1 c1t2d0s0d13 1 1 c1t2d0s13. Use "metattach" to attach the submirrors to the
2. metastat --p | grep c1t1d0d2 1 1 c1t1d0s0d12 1 1mirrors and the synchronization process.
c1t1d0s11. metattach d0 d2d0: submirror d2 is attached
3. Run "metadetach" to remove the failing disk from2. metattach d10 d12d10: submirror d12 is attached
all the submirrors3. Run "metadb" to re-create the replicas that existed
1. metadetach --f d0 d2d0: submirror d2 is detachedpreviously, and verify that the replicas have been
2. metadetach --f d10 d12d10: submirror d12 iscreated.
detached# metadb -a -c 2 c1t1d0s7
NOTE: The "-f" option is not required if the# metadbflags first blk block counta m p luo 16 8192
metadevice is in an "okay" state.dev/dsk/c1t0d0s7a p luo 8208 8192 /dev/dsk
3. Run "metaclear" to remove the failed metadevicec1t0d0s7a p luo 16 8192 /dev/dsk/c1t1d0s7a p luo
from the SVM configuration.8208 8192 /dev/dsk/c1t1d0s7a p luo 16 8192 /dev
 dsk/c1t2d0s7a p luo 8208 8192 /dev/dsk/c1t2d0s7
1. metaclear d2d2: Concat/Stripe is cleared1. Run "metadevadm" on the disk to update the new
2. metaclear d12d12: Concat/Stripe is clearedDevID
3. Run "metadb" to check if there are any replicas on# metadevadm -u c1t1d0
the failed disk, and remove them:Updating Solaris Volume Manager device relocation
# metadbflags first blk block counta m p luo 16 8192information for c1t1d0
dev/dsk/c1t0d0s7a p luo 8208 8192 /dev/dskOld device reloc
c1t0d0s7a p luo 16 8192 /dev/dsk/c1t1d0s7a p luo0523B06W03____AAN0P5606W03
8208 8192 /dev/dsk/c1t1d0s7a p luo 16 8192 /devNew device reloc
dsk/c1t2d0s7a p luo 8208 8192 /dev/dsk/c1t2d0s70523B06W03____AAN0P5606W03
# metadb --d c1t1d0s7Note: This command only work for Solaris 9 and 10.
# metadbflags first blk block counta m p luo 16 81921. Run "metastat" to verify that the SVM
dev/dsk/c1t0d0s7a p luo 8208 8192 /dev/dskconfiguration is in a healthy state
c1t0d0s7a p luo 16 8192 /dev/dsk/c1t2d0s7a p luo1.
8208 8192 /dev/dsk/c1t2d0s7