Back in 2013 I cobbled together a little guide within a post on the FreeNAS users forum on how to add drive to an existing ZFS volume and convert it in to a mirrored volume. I can’t at all remember even writing this little thing, but recent discussion in the old forum over it brought in to doubt whether or not the method would still work. So I spooled-up a VM with the latest FreeNAS (FreeNAS 11) and tried it out. Yup. Still works, see:
ZFS: Adding a drive to create a mirror
Here’s a somewhat updated version of the guide:
* Obviously there’s no warranty. Have backups, etc. I’m just some dude on the Internet, so, you know, you’re on your own
* ‘/dev/adaX’ below is the drive being added, obviously if you get this wrong, you will be very sad.
* ‘MyPoolName’ is the name of your storage pool you’re adding the drive to
gpart create -s gpt /dev/adaX
gpart add -b 128 -t freebsd-swap -s 2G /dev/adaX
gpart add -t freebsd-zfs /dev/adaX
- Run
zpool status
and note the gptid of the existing disk - Run
gpart list
and find the gptid of the newly created partition. It is the rawuuid field. In this example it would be rawuuid of adaXp2 zpool attach MyPoolName /dev/gptid/[gptid_of_the_existing_disk] /dev/gptid/[gptid_of_the_new_partition]
With that done, you can run a zpool status and you’ll see there’s now the additional rawuuid involved, as a mirror member.