4

I'm trying to learn about ZFS for a NAS I'm planning on building. I'm trying to understand if the following scenario would be possible to set up. Disclaimer: I know very little about ZFS, so forgive me if I say something stupid.

  1. I have 4 drives in a zpool configured in raidz2 (RAID 6)
  2. One drive fails
  3. I would like to be able to remove the drive that failed, plug in a new drive and have the system automatically resilver the array without issuing any commands or rebooting.

From what I have gathered zpool set autoreplace=on <pool> would allow the drive the be replaced, but you would still need to issue the scrub command to start the resilver process, right? Also, I have no idea if hotswapping is supported, or not.

I realize that issuing a single command on the rare occasion that a disk fails is not the end of the world. But, in my opinion it would be a lot nicer if it was automated, and I'm pretty sure it can be done with hardware RAID.

2
  • No, you do not need to run scrub when autoreplace is on.
    – longneck
    Feb 12, 2014 at 16:34
  • Thanks everyone for the helpful responses. I must have been reading some old or misleading info on autoreplace. I appreciate it.
    – Dominic P
    Feb 12, 2014 at 19:25

2 Answers 2

5

Set autoreplace=on for your pool and use like or similar disks. Resilvering occurs automatically when that flag is set on the pool. If a hot-spare is defined in the pool, it will also rebuild automatically if autoreplace is on.

There's nothing more to really consider.

3

The autoreplace ZFS pool property is exactly that.

From the ZFS Administration Guide, about the :

If set to on, any new device found in the same physical location as a device that previously belonged to the pool is automatically formatted and replaced.

Also beware, if physically replacing the faulty disk with a new properly working one will trigger the resilvering of the new disk, this would not solve any configuration tweaking done on the other disks, such as adjusting the size of the disk (it is not rare to downsize disks a bit to avoid having the new one being a few KB too short compared to other in the vdev).

In fact, as much as sexy it is to just plugin a new disk and suddenly watching the lights of the other disks flashing like a Christmas tree, it would not cost you much to sit a few more minutes while carefully preparing your new disk before executing zpool replace (my 2 cents). I would say that it make more sense in case of some already prepared hot-spare.

Edit: ashift was a bad example (thanks @ewwhite).

1
  • ashift is set at the pool level... You don't have to "prepare" your disks.
    – ewwhite
    Feb 12, 2014 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .