FreeNAS 11 Add a drive to create a mirrored ZFS volume

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

  1. gpart create -s gpt /dev/adaX
  2. gpart add -b 128 -t freebsd-swap -s 2G /dev/adaX
  3. gpart add -t freebsd-zfs /dev/adaX
  4. Run zpool status and note the gptid of the existing disk
  5. 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
  6. 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.