ZFS: Upgrade single disk to mirror

For a while now I’ve had a single 3TB WD Green in my NAS to store local Borg backups before syncing them to Google Drive a Hetzner Storage Box.

Because I recently replaced my 3TB Reds for 10TB HGST’s, I have some spare drives left.

My goals are:

  • Turn the single disk zpool for backups into a mirrored pair.
  • Replace the WD Green with a WD Red, eventually.

So, today is about upgrading a single disk ZFS pool to a mirrored pair.

Prepare the new disk

The 3TB Red came out of my tank pool. This means it has partitions and metedata suggesting it’s a disk in use by a ZFS pool. To prepare this disk, I’ll need to clean it fully. Note that I’m not going to zero out this disk, since it’ll be me who’s going to use it.

1wipefs -af /dev/sdq

This will destructively clean any and all filesystem / ZFS information on the disk.

Upgrading the ZFS pool

The next step is to upgrade the pool by adding the new device into a mirrored pair.

1zfs attach <pool> <existing hdd guid> <new hdd guid>

By using the zfs attach command like this, you’re creating a mirrored pair out of the existing and new HDDs. After this you’ll need to wait for the new HDD to resilver, but after that you’re all set.