Replace a disk in Solaris (zpool)

To replace a disk in a zpool on Solaris you need to follow a few (logical) steps.

Rescan the system for the new physical disk(s)

# cfgadm -al

Check if the disk is present

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0   Boot
          /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@1/sd@0,0
       1. c1t1d0   Mirror
          /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@1/sd@1,0
       2. c5t600A0B800019E507000031B24EA729D1d0 
          /scsi_vhci/ssd@g600a0b800019e507000031b24ea729d1
       3. c5t600143801259D9050000B000015B0000d0 
          /scsi_vhci/ssd@g600143801259d9050000b000015b0000
       4. c5t600143801259D9050000B000015F0000d0 
          /scsi_vhci/ssd@g600143801259d9050000b000015f0000
       5. c5t600143801259D9050000B000016B0000d0 
          /scsi_vhci/ssd@g600143801259d9050000b000016b0000
       6. c5t600143801259D9050000B00001530000d0 
          /scsi_vhci/ssd@g600143801259d9050000b00001530000
       7. c5t600143801259D9050000B00001570000d0 
          /scsi_vhci/ssd@g600143801259d9050000b00001570000
       8. c5t600143801259D9050000B00001630000d0 
          /scsi_vhci/ssd@g600143801259d9050000b00001630000
       9. c5t600143801259D9050000B00001670000d0 
          /scsi_vhci/ssd@g600143801259d9050000b00001670000

Move the existing data (zpool) to the new disk.
First check the status of the zpool.

# zpool status

Replace the disk

# zpool replace   

To follow up the replacement, you can execute the command “zpool status” again.
You will see two disks in your zpool, after the replacement there is only one disk available and you’ll get the message that it’s resilvered.

# zpool status
  pool: myzpoolname
 state: ONLINE
 scrub: resilver completed after 0h5m with 0 errors on Thu Dec 13 07:35:08 2012
config:

        NAME                                     STATE     READ WRITE CKSUM
        myzpoolname                                    ONLINE       0     0     0
          c5t600143801259D9050000B000015B0000d0  ONLINE       0     0     0  8.34G resilvered

When the zpool is resilvered, you can remove the old disk and run following command again to remove the disk from the system.

# cfgadm -al