FreeNAS webGUI warning

Replacing a harddrive in a ZFS pool on FreeNAS

I recently bought a Western Digital RED drive to replace one of my old Western Digital Caviar Green drives in my FreeNAS storage. As previously mentioned I run a RAIDZ wich is comparable to a RAID-5 so I can do this without data loss.

The RED drives are supposed to be specifically designed for use in 1-5 drive NAS situations and have gotten pretty good reviews so even though it is a bit pricy I wanted to give it a go. In perspective the drive is only 100SEK cheaper then the Caviar Greens were two and a half years ago when I bought those.

Before replacing the drive it is recommended to scrub the pool to make sure everything is in order.

One thing to note is that in order for ZFS to accept a new drive as a replacement it has to have an LBA count that is equal or higher than the old drive. Look it up on the old drive:
[root@void] ~# camcontrol identify ada0 | grep LBA48
LBA48 supported 3907029168 sectors

Then verify with the datasheet for the new drive before purchase. In my case this.

This is a quick step by step of how I did it using the GUI. The next drive getting replaced will be so via cli only.

Navigate via Storage -> View Volumes and then hit “Volume Status” and offline the drive to be replaced:
FreeNAS offline disk

I like to verify things via CLI:
FreeNAS zpool status disk offline

Now shutdown (or hotswap if your system allows for it) and replace the drive.
Bonus tip:
Before shutting down, lookup the serial number of the drive to be extra sure not to remove the wrong physical drive.
[root@void] ~# smartctl -a /dev/ada1 | grep "Serial"
Serial Number: WD-WCAVY44025XX

Once replaced, when the system boots it will see that there is a new drive inserted that you can use to replace the removed with:
FreeNAS replace disk

This starts the resilver, wich is ZFS’s RAID rebuild process. Now you just have to wait. Once again, I like to check the progress via cli:
zpool status during resilver

During resilver I shut down services such as AFP, NFS and CIFS to reduce unnecessary load on the drives.

When the resilver is complete, the pool is still degraded since the old drive is still a part of it.
FreeNAS zpool status after resilver

This is simply fixed by detaching the old drive:
FreeNAS detach disk

Another look with zpool status in cli shows us that all is back to normal again:
FreeNAS zpool status after drive replacement

And that’s it. The new drive is in place and I finally have a cold spare in case one of the disks in the pool fails.

Share

5 thoughts on “Replacing a harddrive in a ZFS pool on FreeNAS

  1. Horst Dehmer

    Thanks to your clean instructions, I was able to replace a WD10EADS drive with a WD20EFRX on a 4 disk raidz2 volume, which already had one WD20EFRX. Two more to go…
    In theory, with four identical 2 TB drives, exporting and importing the volume should give me increased storage. We’ll see how that’ll work out.

  2. Danno

    I replaced a hard drive today for the first time in my FreeNAS box (SMART errors were being kicked out), and after the resilvering completed, I did *not* have to detach the original (failing) drive from the zpool array. Perhaps the functionality for that step to happen automatically was introduced with a recent FreeNAS update…I’m running v 9.3 (“Stable” train). Other than that, these directions were helpful…thanks.

  3. Pingback: ZFS: zpool reparieren, wenn Partitionstabelle beschädigt wurde | D^3 – Dirks Dies & Das

  4. Darryl

    Going to give this process a try on my 3 x 3TB ZFS array. Same scenario: three green drives. Replacing the failed drive with a red upgrade. After that, I’ll replace the others, too, and have two emergency spares. That or sell them and buy a red. Yep, that’s probably what I’ll do …

Leave a Reply

Your email address will not be published. Required fields are marked *