Replacing a failed disk with DiskSuite

Example one

In this example, the boot disk mirror c0t1d0 failed. All submirrors on c0t1d0 were placed in "maintenance" state, so no reads or writes were occurring on the disk. The replacement disk has identical geometry of boot disk c0t0d0.

1. Delete any state database replicas from the failed disk. A "W" in metadb output indicates replica device write errors.

# metadb
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c0t0d0s6
     a    p  luo        8208            8192            /dev/dsk/c0t0d0s6
      W   p  l          16              8192            /dev/dsk/c0t1d0s6
      W   p  l          8208            8192            /dev/dsk/c0t1d0s6

# metadb -d /dev/dsk/c0t1d0s6
# metadb
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c0t0d0s6
     a    p  luo        8208            8192            /dev/dsk/c0t0d0s6

2. Replace the failed disk.

3. Copy the partition table from the good disk to the replacement disk.
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

4. Create state database replicas on the replacement disk.
# metadb -a -c 2 /dev/dsk/c0t1d0s6

5. Determine which submirrors need to be resynchronized.

# metastat | grep 'Invoke: metareplace'
    Invoke: metareplace d30 c0t1d0s0 <new device>
    Invoke: metareplace d31 c0t1d0s1 <new device>
    Invoke: metareplace d33 c0t1d0s3 <new device>
    Invoke: metareplace d34 c0t1d0s4 <new device>
    Invoke: metareplace d35 c0t1d0s5 <new device>

6. Resynchronize the submirrors.

# ./metareplace -e d30 c0t1d0s0
d30: device c0t1d0s0 is enabled
# ./metareplace -e d31 c0t1d0s1
d31: device c0t1d0s1 is enabled
# ./metareplace -e d33 c0t1d0s3
d32: device c0t1d0s3 is enabled
# ./metareplace -e d34 c0t1d0s4
d33: device c0t1d0s4 is enabled
# ./metareplace -e d35 c0t1d0s5
d34: device c0t1d0s5 is enabled

You can monitor the resynchronization progress with metastat.

Example two

In this example, the mirror disk is failing, but one of its submirrors is in an Okay state.

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cf222bde,0
       1. c1t1d0 <drive not available: formatting>
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w2100002037f3ce1d,0

# metastat
...
d20: Submirror of d0
    State: Needs maintenance
    Invoke: metareplace d0 c1t1d0s0 <new device>
    Size: 3073896 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t1d0s0                   0     No    Maintenance 

d21: Submirror of d1
    State: Okay        
    Size: 8389656 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t1d0s1                   0     No    Okay        

d23: Submirror of d3
    State: Needs maintenance
    Invoke: metareplace d3 c1t1d0s3 <new device>
    Size: 525798 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t1d0s3                   0     No    Maintenance 

d24: Submirror of d4
    State: Needs maintenance
    Invoke: metareplace d4 c1t1d0s4 <new device>
    Size: 59114718 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t1d0s4                   0     No    Maintenance 

Since submirror d21 is still in an Okay state, it must be detached from the mirror.

# metadetach d1 d21
d1: submirror d21 is detached

Remaining steps:

1. Delete the state databases from the failed disk.
2. Replace the failed disk.
3. Duplicate the partition table from the good disk to the new disk.
4. Re-create the state databases.
5. Run metareplace on the metadevices that were in "Needs maintenance" state (i.e., d20, d23, and d24 in this example).
6. Run metattach on the detached metadevices (i.e., d21 in this example).

More information:
SUMMARY: RE Replacing mirrored Sun system disk

Back to brandonhutchinson.com.
Last modified: 2008/05/08