HowTo : Add Spare Drives to Zpool

Spare drives in a ZFS or any RAID configuration is a must have. Consider this – A winter storm hits and a snowplow piles 3 feet of snow in your driveway. 5 minutes later a drive in your system fails. You’re stuck until you can plow or snowblow your way out of your drive. Without spare drives in your system, you run the risk of additional drives failing while that drive is offline. Depending on the ZFS or RAID level a second drive failure could cause permanent data loss. If you have a spare drive (or multiple spare drives) in your system, you can automatically start rebuilding the array as soon as it detects that a drive has failed. This limits the amount of time that your ZFS or RAID subsystem is unprotected.

To add spare drives to your system first run the format command to find the disks that you have in your system.

Format Command

Once you have run the format command, you should have a list of disks that you can select for your spare drives. Select the ones that you would like to use (Our spare drives are c4t23d0 and c4t24d0) and issue this command :

zpool add tank spare c4t2d0
zpool add tank spare c4t3d0

Once you issue that command, it should add the spare drives to the zpool. Run the “zpool status” command to make sure it was updated as expected.

ZFS Add Spare Drives
ZFS Spare Drives Added

Thursday, June 3rd, 2010 RAID, ZFS

6 Comments to HowTo : Add Spare Drives to Zpool

  • notjoe says:

    I just want to start off by saying I love your site. There is so much useful information on zfs, which is great for someone who is starting to play with it.

    I have a question. Once you’ve added the hot spare, wil it automatically get used in the event of a disk within the pool going defunct?

  • It will get automatically used if it is assigned to the pool, but it does not get used as a permanent replacement. It is only used in the interim until a new disk can be put into the system. There are ways to force it to become part of the pool, and become the actual replacement drive, but default behavior is that it is used as a spare until the replacement drive is put into service.

  • matkix says:

    Questing regarding disk labels. Your disks have shorter labels, when I run the format command I get the following:

    12. c0t5001517BB2A9B8E7d0
    /scsi_vhci/disk@g5001517bb2a9b8e7
    13. c0t5001517BB2A9BA97d0
    /scsi_vhci/disk@g5001517bb2a9ba97

    Any ideas?

    Thanks for your blog, quite helpful.

  • Are you using SAS disks, or SATA disks? In ZFSABuild2010 we were using SATA disks, which had the shorter disk label. All of our SAS disks in ZFSBuild2012 use the longer WWN’s in the disk labels.

  • PlowHouse says:

    Hey Guys, I was reading this thread as I too have a spare drive in my ZFS raidz2 setup and I had no idea that the spare drive was a temporary fix until the drive is replaced. But I noticed Matt mentioned there is a way to force the spare drive to become a primary part of the pool. Could you please elaborate on how that is properly done? Any help on this would greatly be appreciated.

    Thanks.

  • First – run zpool status – if the status is degraded, then you need to replace the drive. If the status “Online” then you are fine. Check that first, and report back.

  • Leave a Reply

    You must be logged in to post a comment.