ZFS Convert ZFS two-disk unmirrored pool to mirrored

I have a storage pool aptly called "storage" with two disks in it. Originally, I wanted to add the second disk as a mirror but did the ZFS newbie mistake of using

zpool add storage <device>

instead of

zpool attach storage <device>

Every attempt to remove or detach the second device from the pool fails, because ZFS complains about not having redundant drives. After reading into it, I understand the issue and why this is. However, I wasn't able to find a solution how to either remove the drive to re-attach it or simply convert the whole pool to mirrored instead of striped. I'm also kind of puzzled by the fact there seems to be no straight-forward way to do it.

Is there a way to achieve this short of destroying and recreating the pool? All my research lead me to find that this appears to be impossible.

What I have done in the meantime is purchase another disk of same capacity. My plan is now to create a three-disk RAIDZ1 through a trick of creating a memory device, using this for the third disk, offline it, copy the data over and replace the offline "disk" with the real one afterwards.

Being quite new to FreeBSD and especially ZFS, this filesystem seems to squarely focus enterprise deployments. Coming from the Linux world and being an early user of btrfs, the inability to grow a pool with a single disk after its creation feels pretty monolithic to me. There are no doubt good reasons for this, therefore my questions:

  • I'm using this on my home server. Is ZFS even a good idea in this setting, given that I neither have the resources for large storage systems nor a way to plan far ahead?
  • Is the pool migration strategy I plan on using sound?
  • Will I still find bliss in the BSD world despite those setbacks? I grow to dislike the Linux cosmos more and more for being so cluttered. Especially btrfs feels just so... clunky and cheap.
 
Is there a way to achieve this short of destroying and recreating the pool?

No. Once you add a virtual device to a pool, ZFS starts using it, so you can never remove it. You'll need to back up your data and recreate the pool.

Coming from the Linux world and being an early user of btrfs, the inability to grow a pool with a single disk after its creation feels pretty monolithic to me.

But you can grow a pool with a single disk; in fact, you did grow a pool with a single disk. So I'm not sure what you mean.

As for your plan: I wouldn't go about it that way. Just back up your data to the new disk, destroy the pool, and recreate it as a mirror. You might choose to attach the third disk to the mirror, or save it as a spare replacement for when one of the other two dies. But ZFS mirrors are much more flexible than RAIDZ, so if you can't be sure what your storage needs might be in the foreseeable future, mirrors are easier to work with (growing a RAIDZ pool basically means either replacing every disk in the pool, or doubling the number of disks in the pool, all at once).
 
Back
Top