Thursday, April 17, 2008

Solaris Disk replacement Procedure - Meta Devices

Here is a quick cheat sheet on the steps involved in replacing a mirrored disk managed by Sun Solaris Disk Suite. In this procedure there are steps embedded to actually break the mirrors, do the replacement and recreate the mirrors, to finally rebuild the data back into the failed disk.

Steps to follow are :

1. Login to the machine as root. Note down the metastat and metadb -i output to determine the number of existing entries for the metadevices. This is extremely important to serve as a comparison, and later on for verification.

Remove disk from disksuite configuration, to prepare it for physical replacement

Example:

(detach submirror d10 from mirror d0)

metadetach d0 d10

metadetach d1 d11

metadetach d3 d13

metadetach d4 d14

clear detached submirrors using disk cxtxdx:

metaclear d10

metaclear d11

metaclear d13

metaclear d14

Remove db replicas from disk c0t0d0s7

metadb -d /dev/dsk/cxtxdxs7


2. copy partition table from cxtxdxs2 to a file called /tmp/vtoc

prtvtoc /dev/rdsk/cxtxdxs2 > /tmp/vtoc


3. Have the field engineer physically replace disk c0t0d0 within the media tray.


4. Execute For solaris 8 and up devfsadm (or drvconfig;disks;devlinks )

This command readds the drive into solaris device tree.


5. copy partition table back to the drive from saved file /tmp/vtoc.

fmthard -s /tmp/vtoc /dev/rdsk/cxtxdxs2

verify labeling is correct with format --> partition --> print (for both the main and the mirror disks) and verify that they are exactly the same.


6. Recreate db replicas on slice 7

metadb -a -c 3 cxtxdxs7

metadb -i (should have the same number of replicas on the main and the mirror disks, in the above example 3 )


7. Recreate your submirrors

metainit d10 1 1 cxtxdxs0

metainit d11 1 1 cxtxdxs1

metainit d13 1 1 cxtxdxs3

metainit d14 1 1 cxtxdxs4


8. Reattach submirrors to resync data

metattach d0 d10

metattach d1 d11

metattach d3 d13

metattach d4 d14


9. metastat d0,d1,......

Maintenance is complete once the resync completes ..all metadevices should report as okay.