Replace Disk Drive in SmartOS


This is an almost verbatim copy of Replacing a Failed Disk in SmartOS but when it counted I couldn’t find that particular post. I will try to elaborate a little bit on the original post.

I had an issue on my SmartOS system at home where the disk names changed due to a missing drive. ie. I removed the first drive in my array(c0t0d0) and after the reboot the second drive in the array became c0t0d0, the third drive became c0t1d0 . A better way to replace the drive is to do it without rebooting.

This assumes the failed drive is c0t0d0 in slot sata0/0

Replacing a failed drive

  1. Offline the failed drive: zpool offline zones c0t0d0
    This is fairly self explanitory. The drive is taken offline and all IO on the device ceases whilst remaining part of the pool.
  2. devfsadm -C -c disk -v (may not be necessary)
    This command will attempt to clean up any ‘dangling logical links’. The -C runs devfsadm in cleanup mode, the -c disk limits operations to the device class disk. The -v runs the command in verbose mode.
  3. devfsadm -c disk -v (may not be necessary)
    I’m not entirely sure what this does.
  4. cfgadm -l you should see type sata-port & receptacle disconnected. If you don’t do this, type will be unknown (may not be necessary)
  5. cfgadm -f -c connect sata0/0
    Forces the connection on sata0/0
  6. cfgadm -l should show type disk, receptacle connected, occupant unconfigured
  7. cfgadm -c configure sata0/0
    Allows the disk to be usable
  8. cfgadm -l should now show occupant configured
  9. zpool replace zones c0t0d0 I got an error that the drive was already part of a ZFS pool because it was a used drive. In that case, do: zpool replace -f zones c0t0d0

That’s about it. Just online the device and wait for the re-silver.