2x different size mirrors using ZFS

mirroringzfs

I currently have a 4 uneven drive unRAID box. I'd like to migrate to Ubuntu and ZFS, but not quite sure what is possible with ZFS. I'd like to buy 2x 6TB drives, to use in a mirrored configuration. Then once I've moved my data I'd like to add in 2 of the old 3TB drives as another mirror.

1) Is the following setup possible:

d1: 6TB
d2: 6TB mirror of d1
d3: 3TB
d4: 3TB mirror of d3

2) When drives drop in price, is it easy to replace d3 and d4 with larger drives?

Best Answer

Yes, this is possible. If you read a little on ZFS, you’ll find that it’s basically a pool of so-called “vdev”s. The simplest vdev would be a plain physical drive. It could also be a mirror consisting of two or more physical drives. This is what you want.

You’d go for this structure:

d1    d2  d3    d4
 \    /    \    /
 mirror    mirror
      \    /
      mypool

To create this zpool, use the following command:

zpool create mypool mirror d1 d2 mirror d3 d4

This will result in a usable capacity of 9 TB. It can tolerate one drive failure per mirror vdev. (Unless you add more mirrors, of course.)

If you want to add vdevs later, use this command:

zpool add mypool mirror d3 d4

To extend the pool size, first enable the autoexpand option:

zpool set autoexpand=on mypool

Then replace one of d3/d4 with a larger drive and wait for it to rebuild. After that, replace the other. The pool should automatically expand to the available drive size.

It might be desirable to turn off autoexpand after the job is done.

Alternatively, you can leave autoexpand alone and use the following commands after you replace both drives:

zpool online -e mypool d3
zpool online -e mypool d4