228 points · by chungy · 4y ago · 113 comments
Always reminds me of when NetApp used to do their arrays in RAID-4 because it made expansion super-fast, just add a new zeroed disk and only had to update the new disk blocks + parity drive on writes. Used to blow our Netware admin's mind as almost nobody else ever used RAID-4 -- I had it as an interview question along with "what is virtual memory" because you'd get interesting answers :)
As a home server administrator, I've wanted this feature for so long. Before this, in order to expand an existing array I'd have to fail every single drive and replace them with new higher capacity ones.
The only question I have is whether it supports expansion with drives of different capacities.
I’m also very interested in this - my main reason for sticking with btrfs is that I can use a variety of odd-sized drives, and expand it by adding a new oddly-sized drive...
After that, can we have defragmentation?
Let's make the best of both worlds.
I can see a conceptual sort of super-scrub that balances a zpool and addresses all that that's not on anyone's radar AFAIK.
Workload is roughly
Every night write a lot of files
6/7 nights delete a lot of files (i.e. keep weekly snapshots).
It took about 3-5 years of doing this to get to the point where write-performance dropped off the clif and enabling metaslab_debug brought it back.
With XFS, I can xfs_fsr to undo it. With Btrfs, I can fi defrag to undo it.
With ZFS, reformat the disk. I'm not comfortable with that.
https://www.usenix.org/system/files/login/articles/login_sum...
RAID5 has the benefit of not making the parity drive a bottleneck that will fail sooner.
The code is here[0]. It still needs more testing and cleanup, and will then eventually be merged. After that it'll take some time to make to all the distributions ( freenas, freebsd, etc. )
> But the interesting thing about this project is how did it come to be. So a long-requested feature - how did it get funded? So actually, it’s funded by the FreeBSD Foundation.
Now I found why OP posted by FreeBSD Foundation.
One downside that I see of this approach, if I understand it correctly, is that the data already present on disk will not take advantage of the extra disk per slice. For example, if I have a raidz of 4 disks (so 25% of space "wasted"), and add another disk, new data will be distributed on 5 disks (so 20% of space "wasted") but the old data will keep using stripes of 4 blocks, they will just be reshuffled between the disks. Do I understand it correctly ?
Rewriting data in place can be tricky, if you have old enough snapshots the newly added space may not be enough. I hope they will find a good enough solution.
It's a constraint on iops in particular, not bandwidth, because writing a record to disk involves writing something to every disk in the pool. So if you have a disk that's taking a long time to write, the other disks need to pause and let it catch up.
Naively I would expect that to become 25 data writes per disk, and then the fsync would go to all disks.
That might be about 30 writes total, so I'd expect it to be at least 3x as fast as a single disk.
Where does that expectation break down?
For writes, the system is copy-on-write, so for each write, there is a full read of the containing record, often across all disks, so the updated record can be written out in the new location on the disks without disrupting the old record, which may still be referenced by snapshots, etc.
Adding additional disks gets you more throughput (you can split a single large write across more disks, but not more OPS.)
The 500 disk writes are parallelized over 5 disks so they only take the time taken for 100 writes (500 / 5).
So the IOPs is the same as a single disk.
HOWEVER, bandwidth is 4x. The above assumes that seek time dominates. If your writes are multiple slices in length, they will be written 4x faster because the amount of data per disk is divided across the disks. If you're reading and writing large contiguous files, then you do get a big I/O boost from raidz.
The hierarchy is disk < vdev < zpool.
Disk is physical.
vdev is logical. Purpose: Disk grouping and redundancy. Composition: One or more disks.
zpool is logical. Purpose: Higher-level management of one or more vdevs. Composition: It acts like a JBOD.
---
zpools can be thought of as "stripes of vdevs". This, in the narrow sense that the failure of any vdev in a zpool is a permanent loss of the entire zpool. All your redundancy in the ZFS ecosystem is via mirrored or RAID'ed vdevs.
---
The setup I have heard of that balances performance, redundancy and space is to do what you say: Have a zpool of multiple mirror-type vdevs.
You can also stripe at the vdev level, which I would assume has higher performance than having multiple single-disk vdevs in a pool - I'm unaware of the differences at a low level.
The old way ( as you referenced ) was to replace each disk one by one with a larger one.
If I'm understanding this right, and please correct me, this feature will allow you to add a 5th disk to a 4 disk raidz
And if I'm right about that, then this feature wouldn't really make sense for RAID10 anyway
Adding drives to a mirror has worked in zfs since prehistoric times. “zpool attach test_pool sda sdc” will mirror sda to sdc. If sda was already mirrored with sdb, you now have a triple-mirror with sda, sdb, and sdc.
Forcing ZFS to store multiple data blocks also can be done.
This is great for ZFS on flash drives.
https://docs.oracle.com/cd/E19253-01/819-5461/gevpg/index.ht...
AFAIK it's being developed against FBSD, but is not any more integrated there than it is in the main OpenZFS project.
If you want "feature chasing", FreeBSD ZFS TRIM is the ur example. I've read that code end to end... and I'll leave it at this.
Of course, it gives "better publicity" for RAID-Z, but it is rather an marketing trick not engineering.
In other words, what they are saying is that the traditional way to expand an array is essentially to rewrite the whole array from scratch, so if the old array has three stripes, with blocks [1,2,3,p1] [4,5,6,p2] and [7,8,9,p3] (with p1 and p2 being the parity blocks), the new array will have stripes [1,2,3,4,p1'], [5,6,7,8,p2'] and [9,x,x,x,p3'], i.e. not only has to move the blocks around, but also recompute essentially all the parity blocks.
IF I understand the ZFS approach correctly, the existing blocks are not restructured but only reshuffled, so the new layout will be logically still [1,2,3,p1] [4,5,6,p2] and [7,8,9,p3] but distributed on five disks so [1,2,3,p1,4] [5,6,p2,7,8], [9,p3,x,x,x]
It seems that this means less work while expanding, but some space lost unless one manually copies old data in a new place.
IF I got it right, I am not sure who is the intended audience for this feature: enterprise users will probably not use it, and power users would probably benefit from getting all the space they could get from the extra disk