I have a one-drive zfs pool named data on my desktop computer, created with something like zpool create data /dev/mapper/data (zfs on luks). I would like to convert it into a raid1 pool, but only have 1 more drive to play with, and one more slot in my machine.

Can I somehow tell zfs to convert my data pool into a mirror, using the new drive as the 2nd drive in the set?

If that is not possible, is there a way to create a new degraded mirror pool using just the new drive (since I don't have a 2nd drive yet)? That would give me a chance to copy my data from the old pool into the new mirror pool, then add the original drive to the new pool.

2 Answers 2


I'm new to FreeBSD, and haven't yet used ZFS. However, based on my research, why not use

#zpool attach mypool /dev/sdX /dev/sdY

instead of all of that? Should automatically convert the pool to a mirror.

  • thanks, that worked! It is the easy route I was hoping I could take, but couldn't find any examples or documentation of by googling. My "solution" below, which I wrote before getting any responses, was for the second [less-than-optimal] method, involving creating a degraded mirror pool, manually copying data over, then adding drive to mirror. Your method was quick and easy. Thanks. Jun 21, 2019 at 4:13

I didn't think I'd be answering my own question, but after much googling and spinning up a vagrant box with multiple disks to experiment with, I found how to create a degraded zfs mirror (raid1) pool.

I will post it here so it is available for anyone that also has this problem.

# create sparse file, as placeholder for 2nd disk
truncate -s 1GB /tmp/placeholder.img

# create the new mirror pool
zpool create mypool mirror /dev/sdX /tmp/placeholder.img

# immediately place sparse file offline, so zfs won't write to it
zpool offline mypool /tmp/placeholder.img

# verify mirror pool is degraded
zpool status -v

# later, once 2nd disk is available, replace sparse file with new disk
zpool replace mypool /tmp/placeholder.img /dev/sdY

# verify new drive is there, and pool is either resilvering or ONLINE
zpool status -v
  • 1
    There's no need to do that. Just attach the second disk when it's available. E.g. zpool create mypool /dev/disk1 and then later when you're ready to start mirroring, zpool attach mypool /dev/disk1 /dev/disk2. The pool doesn't need to START as a mirror pool - you can make it a mirror later.
    – mmusante
    Jun 20, 2019 at 17:42
  • 1
    Adding to @mmusante's comment, note that the usable size of a mirror vdev will be the lowest of all constituent devices. (Correspondingly, for a raidz* vdev, the usable capacity will be the number of devices, minus the number of parity devices, times the size of the smallest constituent device.) Since you're giving ZFS a 1 GB sparse file as part of a mirror vdev, this limits the vdev capacity, and thus the capacity of the pool, to 1 GB. That said while this is unnecessary for a mirror vdev, it's a common trick when setting up raidz* vdevs when not all drives are available initially.
    – user
    Jul 14, 2019 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.