ZFS Upgrade 2 mirrored drives to 3 drive raidz?

4

1

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

Arne

Posted 2015-05-11T22:32:11.243

Reputation: 143

Answers

2

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.

Mike Fitzpatrick

Posted 2015-05-11T22:32:11.243

Reputation: 15 062

considering that the two existing drives are in an external USB 3.0 bay and the potential 3rd one is on the internal SATA port, would mirroring the 3rd help performance? – Arne – 2015-05-12T05:37:41.937

You might see an increase just by adding the third drive because ZFS can stripe between the mirror and the single drive but your pool is no longer redundant. If you add a 4th drive you can then have a mirrored stripe which has performance of a stripe but with redundancy. ZFS performance is dependant in a combination of many things, including your pool setup and your own disk usage patterns. Read performance can also be different from write performance. – Mike Fitzpatrick – 2015-05-12T06:00:43.190

Maybe I quite don't unterstand ZFS mirroring right; when I have 3 drives of 1TB capacity (two external, one internal) and all three are mirrors in a pool - do I loose (!) redundancy? I would have expected the setup be even safer... can you please clarify? – Arne – 2015-05-12T06:35:53.237

Well, you could theoretically mirror all three drives, giving you 1TB usable capacity with triple redundancy but I've been assuming you wanted to increase the capacity of your pool by adding the third drive. Adding a third drive as a triple mirror will increase your redundancy but not your capacity. If you want to increase your capacity and use raidz for redundancy you can only achieve that by destroying your current pool and creating a new pool with a raidz vdev and restoring your data from backup. – Mike Fitzpatrick – 2015-05-12T07:06:25.447

Alright, that's how I understood it. 3 drives @ 1TB mirrored = 1TB total capacity at the benefeit of added redundancy and possibly read-performance because the 3rd drive is on a separate controller. – Arne – 2015-05-12T08:02:45.050

5

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:

  1. Break the existing mirror by removing one of the existing disks
  2. Create a sparse file and mount it as a loopback device
  3. Create the new Raid-Z1 using the new disk, the one just removed and the sparse file
  4. Immediately degrade the raid by removing the sparse file device
  5. copy all the data across from the degraded mirror to the degraded raid-z1
  6. 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://blogs.oracle.com/zhangfan/entry/how_to_turn_a_mirror

Gareth

Posted 2015-05-11T22:32:11.243

Reputation: 61