4

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?

  • Your scenario works, but you should know that ZFS does not rebalance contents if vdevs are added later (after data has been written). This means that in your case, 100% of your data will be on the first mirror initially, reducing performance from RAID 10 to RAID 1. Only newly written data (newly added data as well as changed data because of CoW) will be balanced over the vdevs. Over time, your performance will increase, depending on your usage patterns (for read only, it will never get better). – user121391 Jul 11 '16 at 7:01
  • Yes that is a valid point, but at this moment I'm less concerned about performance, and more concerned about avoiding silent errors. – squarefrog Jul 11 '16 at 7:44
9

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
  • Thanks so much. Thats exactly what I needed to know. I'll read up on vdev. – squarefrog Jul 10 '16 at 11:39
  • Oh please oh please oh please, don't encourage people to blindly turn on autoexpand. To use zpool online -e is far safer because what it does is actually predictable. – a CVn Jul 10 '16 at 12:03
  • I don't see how it would be unpredictable, but then again I only use whole drives. – Daniel B Jul 10 '16 at 12:07
  • Mainly it's unpredictable if you forget to turn it back off. By using zpool online -e, the expansion is an explicit, one-time operation manually performed by the administrator on a single device. I'm not saying autoexpand=on doesn't have its place, but it's one of those things (just like zpool add/zpool attach) that can potentially come back and bite you quite bad if you aren't careful. I use ZFS myself, and love it, but there are a few areas where it's obvious that it was designed for people who get paid to manage computer systems and you need to tread carefully. – a CVn Jul 10 '16 at 12:23
  • 1
    Good answer, I'd like to add that while adding vdevs is easy, removing (not replacing) them is impossible. Therefore you should plan what you want to do beforehand. – user121391 Jul 11 '16 at 7:02

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.