ZFS Upgrade 2 mirrored drives to 3 drive raidz?
I have two 1GB drives configured as ZFS mirrors and now have the possibility to add a 3rd drive of 1GB. Can I reconfigure my mirror to a 3 drive raidz of (N-1)=2GB total capacity?
I am running zfs-fuse on Debian Jessie
Solution 1:
Short answer is no, you can't convert it. You'll need to backup, destroy the mirror, create a raidz and restore the filesystems from backup.
ZFS supports adding drives to pools without upsetting the original data but you cannot change the configuration (mirror, raidz, etc.) of existing drives in the pool.
In your case you could (although I don't recommend it) add the third drive to your existing pool and the extra space would become available to all ZFS filesystems in the pool but you wouldn't have redundancy on the entire pool.
You could add two drives as another mirror to the same pool and then you'd have additional space with mirror redundancy across the whole pool.
I have run raidz (home use, not production) in the past but I now prefer mirrors for their simplicity and performance (particularly on scrubs), despite lower usable capacity.
Solution 2:
I'm about to do this and found an old blog that indicates that it can be done.
Caution: this process puts the raid in a degraded state while migrating. This significantly increases data loss probability!
The idea is to:
- Break the existing mirror by removing one of the existing disks
- Create a sparse file and mount it as a loopback device
- Create the new Raid-Z1 using the new disk, the one just removed and the sparse file
- Immediately degrade the raid by removing the sparse file device
- copy all the data across from the degraded mirror to the degraded raid-z1
- destroy the mirror and add the disk into the raid-z1 and let it resilver.
Admittedly I'm going to be doing this on SmartOS rather than Linux, but I assume Linux ZFS is advanced enough to do this.
More info on the approach can be found at https://web.archive.org/web/20151017154015/https://blogs.oracle.com/zhangfan/entry/how_to_turn_a_mirror