Solaris Volume Manager Administration Guide

Replacing Disks

This section describes how to replace disks in a Solaris Volume Manager environment.

How to Replace a Failed Disk

  1. Identify the failed disk to be replaced by examining the /var/adm/messages file and the metastat command output.

  2. Locate any state database replicas that might have been placed on the failed disk.

    Use the metadb command to find the replicas.

    The metadb command might report errors for the state database replicas located on the failed disk. In this example, c0t1d0 is the problem device.


    # metadb
       flags       first blk        block count
      a m     u        16               1034            /dev/dsk/c0t0d0s4
      a       u        1050             1034            /dev/dsk/c0t0d0s4
      a       u        2084             1034            /dev/dsk/c0t0d0s4
      W   pc luo       16               1034            /dev/dsk/c0t1d0s4
      W   pc luo       1050             1034            /dev/dsk/c0t1d0s4
      W   pc luo       2084             1034            /dev/dsk/c0t1d0s4

    The output shows three state database replicas on slice 4 of the local disks, c0t0d0 and c0t1d0. The W in the flags field of the c0t1d0s4 slice indicates that the device has write errors. Three replicas on the c0t0d0s4 slice are still good.

  3. Record the slice name where the state database replicas reside and the number of state database replicas, then delete the state database replicas.

    The number of state database replicas is obtained by counting the number of appearances of a slice in the metadb command output in Step 2. In this example, the three state database replicas that exist on c0t1d0s4 are deleted.


    # metadb -d c0t1d0s4
    

    Caution – Caution –

    If, after deleting the bad state database replicas, you are left with three or fewer, add more state database replicas before continuing. This will help ensure that configuration information remains intact.


  4. Locate any submirrors that use slices on the failed disk and detach them.

    The metastat command can show the affected mirrors. In this example, one submirror, d10, is using c0t1d0s4. The mirror is d20.


    # metadetach d20 d10
    d20: submirror d10 is detached
  5. Delete any hot spares on the failed disk.


    # metahs -d hsp000 c0t1d0s6
    hsp000: Hotspare is deleted
  6. Halt the system and boot to single-user mode.


    # halt
    ...
    ok boot -s
    ...
  7. Physically replace the failed disk.

  8. Repartition the new disk.

    Use the format command or the fmthard command to partition the disk with the same slice information as the failed disk. If you have the prtvtoc output from the failed disk, you can format the replacement disk with fmthard -s /tmp/failed-disk-prtvtoc-output

  9. If you deleted state database replicas in Step 3, add the same number back to the appropriate slice.

    In this example, /dev/dsk/c0t1d0s4 is used.


    # metadb -a c 3 c0t1d0s4
    
  10. Depending on how the disk was used, you have a variety of things to do. Use the following table to decide what to do next.

    Table 24–1 Disk Replacement Decision Table

    Type of Device... 

    Task 

    Slice 

    Use normal data recovery procedures.  

    Unmirrored RAID 0 volume or Soft Partition 

    If the volume is used for a file system, run the newfs command, mount the file system then restore data from backup. If the RAID 0 volume is used for an application that uses the raw device, that application must have its own recovery procedures.

    RAID 1 volume (Submirror) 

    Run the metattach command to reattach a detached submirror, which causes the resynchronization to start.

    RAID 5 volume 

    Run the metareplace command to re-enable the slice, which causes the resynchronization to start.

    Transactional volume 

    Depends on underlying volume type. If the transactional volume is on a RAID 5 volume, for example, follow those instructions in this table. 

  11. Replace hot spares that were deleted, and add them to the appropriate hot spare pool or pools.


    # metahs -a hsp000 c0t0d0s6
    hsp000: Hotspare is added
  12. Validate the data.

    Check the user/application data on all volumes. You might have to run an application-level consistency checker or use some other method to check the data.