I've done something similar for the purpose of getting FDE with ZFS in linux. It can be a little finicky, but it's definitely workable.
One ZFS-specific caveat (which may conflict with your desire to get high storage efficiency): you way need to prevent your ZFS pools from filling up too much [1]. You can either enable discard/TRIM on the whole stack, so the top level FS (e.g. ext4) can let ZFS know when a block is actually free. Or alternative just to limit your zvols to 85% (for example) of their respective pools. The latter is my preference, because there was originally a bug with discard in zfs and it's not immediately clear if it's totally fixed (although my fstrim tests seemed to work out fine).
[1] https://www.reddit.com/r/zfs/comments/3vtur4/what_exactly_ha...
I ran some quick benchmarks (data below). Obviously this is far from rigorous, but maybe it'll be useful. In previous tests I found that volblocksize=128K was optimal for my stack -- which is why the last benchmarks use that setting.
Every additional ZFS filesystem in the stack may reduce storage efficiency (minimum free space requirements [1]; metadata & checksum overhead [2][3]) -- that's why I used ext4 as the top layer instead of another ZFS.
[1] (as mentioned before) https://www.reddit.com/r/zfs/comments/3vtur4/what_exactly_ha...
[2] https://news.ycombinator.com/item?id=14756360
[3] https://forums.freenas.org/index.php?threads/what-is-the-exa...
Test setup:
debian stable
kernel 4.9.0-3-amd64
zfs 0.6.5.9-5
ZFS "pool": mirror with 2x 7200rpm drives
Benchmark command:
for i in `seq 1 10`; do sync; dd if=/dev/zero of=DEST bs=1M count=1024 conv=fdatasync; done
zfs mirror -> dataset
Data (MB/s): 125,115,104,135,148,170,135,151,118,119
Mean (MB/s): 132.0
Std.dev.: 19.9
zfs mirror -> zvol (volblocksize=8K [default])
Data (MB/s): 150,115,127,125,122,118,105,118,124,128
Mean (MB/s): 123.2
Std.dev.: 11.6
zfs mirror -> zvol (volblocksize=128K)
Data (MB/s): 68.5,112,115,114,94.3,85.1,83.1,98.4,120,108
Mean (MB/s): 99.8
Std.dev.: 16.9
zfs mirror -> zvol (volblocksize=128K) -> luks -> ext4 (my stack)
Data (MB/s): 130,94.4,109,139,138,125,94.9,124,134,133
Mean (MB/s): 122.1
Std.dev.: 16.8
edit: formattingIn my case, I wanted a reliable filesystem, RAID1/mirror support, block-level checksumming, and full-disk encryption. No filesystem provides these on linux right now. My solution was therefore to use ZFS to provide a mirrored, checksummed, reliable volume -- onto which I put a standard LUKS-encrypted ext4 filesystem. In the past I had tried the opposite (LUKS on the bare drives, then a ZFS mirror of the 2 decrypted volumes), but it was kinda annoying to manage, and I don't really need the other ZFS features (like snapshotting).
In the grandparent post, the requirement was the ability to expand the RAID volume without rebuilding (something that ZFS doesn't offer), plus checksumming and reliability (which ZFS does offer). So one option would be to use mdadm to manage the RAID array, and then put ZFS on the resultant volume in order to get checksumming.
The disadvantages are: extra complexity; extra overhead; more potential points of failure; more management hassle; etc. As soon as encryption for ZFSonlinux is stable, I'll be very happy to drop this filesystem stacking in favor of that!
Hopefully one of the other solutions will work, otherwise I'll just have to build it.
They have a patreon if you wish to contribute that way.
At this rate XFS will end up evolving to add all the features btrfs promised before the latter makes them stable.
It may be "RAID0 on top of your RAID5/6" but it's all integrated and works smoothly. What I do is have two raidz2 vdevs of 4 disks each, one twice the size of the other, and alternate which one I upgrade (i.e. I started with 4x250gb disks and 4x500gb disks, a few years later replaced the 250gb ones with 1tb ones, then the 500gb ones with 2tb ones, and most recently the 1tb ones with 4tb ones). But yeah I am now stuck with at least 8 disks and if I wanted to migrate off them I'd have to do so all in one go.
I know that it does but I don't like the way you lose your entire pool if a single vdev fails. I'd have less of a problem with it if a pool could distribute data such that a vdev failure results in the loss of only what was on that vdev.
[1] http://www.spacex.com/about/capabilities in case you need one
- Using parity rather than mirroring. I'm happy to deal with some loss of IOPS in exchange for extra usable storage.
- That deals with bitrot.
- That I can migrate to without somehow moving all of my files somewhere first (i.e. supports addition/removal of disks).
- Is stable (doesn't frequently crash or lose data)
- Is free or has transparent pricing (not "Contact Sales").
- Ideally, supports arbitrary stripe width (i.e. 2 blocks data + 1 block parity on a 6 disk array)
Unfortunately it doesn't appear that a solution for this exists:
- ZFS doesn't support addition of disks unless you're happy to put a RAID0 on top of your RAID5/6 and it doesn't support removal of disks at all when parity is involved. It is possible to migrate by putting giant sparse files on the existing storage, filling the filesystem, removing a sparse file, removing a disk from the original FS and "replacing" the sparse file with the actual disk but this is somewhat risky.
- BTRFS has critical bugs and has been unstable even with my RAID1 filesystem.
- Ceph mostly works but I always seem to run into bugs that nobody else sees.
- I couldn't even figure out how to get GlusterFS to create a volume.
- MDADM/hardware RAID don't deal with bitrot.
- Minio has hard coded N/2 data N/2 parity erasure coding, which destroys IOPS and drastically reduces capacity in exchange for an obscene level of resiliency I don't need.
- FlexRAID either isn't realtime or doesn't deal with bitrot depending which version you choose.
- Windows storage spaces are slow as a dog (4 disks = 25MB/s write).
- QuoByte, the successor to XtreemFS has erasure coding but has "Contact Us" pricing and trial.
- Openstack Swift is complex as hell.
- BcacheFS seems extremely promising but it's still in development and EC isn't available yet.
I'm currently down to fixing bugs in Ceph, modifying Minio, evaluating Tahoe-LAFS and EMC ScaleIO or building my own solution.