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.
- I have 4 drives in a zpool configured in raidz2 (RAID 6)
- One drive fails
- 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.
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 ifautoreplace
is on.There's nothing more to really consider.
The
autoreplace
ZFS pool property is exactly that.From the ZFS Administration Guide, about the :
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).