The article's suggestion means eating up 50G of allocation straight away. I don't think needing to estimate your compressed allocation up front is an easier solution at all. Normally with directories you use thin provisioning pulling from the whole device's free space; thick provisioning for a directory is not a path for easier reduce space consumption.
Yes, but ZFS is probably more memory hungry and somewhat an overkill just for compression alone. It's a pity simpler filesystems don't have transparent compression.
One disadvantage of zfs in this case is that it uses its own caching layer, since it's basically an OS subsystem in itself. So on a memory constrained host (eg. rpi), you might have some issues with the zfs and linux buffers competing for RAM.
What does the calculation for file system compression look like these days? On one hand we've got faster SSDs, but on the other we've got more spare cores and SSD space is relatively expensive compared to HDD space.
With LZ4 overhead is rather low, generally you'd get higher end to end throughput with LZ4 enabled. It's not as space efficient as more expensive algorithms but great for high performance scenarios.
Yes, he had a real world problem, discovered that there's not really a great solution in existence, made a new tool to solve it, and presented it in its entirety, all in a single page.
Is there a way to mount loop device without sudo? Some kind of FUSE option?
It's useful as a workaround for 32-bit applications which aren't built with LFS (Large File Support) enabled, and because of that fail on large XFS partitions. It's a very common bug in games which come out in 32-bit only. Making a loop device is a workaround, but using sudo for it all the time is annoying.
Also, there is probably no need to explicitly create a loop device, unless you already used up all existing ones (see man mount):
if no explicit loop device is mentioned (but just an
option `-o loop' is given), then mount will try to find
some unused loop device and use that, for example
mount /tmp/disk.img /mnt -o loop
I.e. in such case I simply create an empty file of certain size, then format it with some filesystem, and then mount it as a loop.
For iso images you can use fuseiso (https://wiki.archlinux.org/index.php/Fuseiso). While for all other purposes you really should take the time to learn about udisks. ArchWiki would be a great place to start.
What about data safety? Say, a hard drive got a bad sector, then a whole file is broken. This always stopped me from using system-wide compression. But maybe it's not as bad as I suppose.
In theory you should get far better robustness by combined use of compression and FEC/ECC over storing content as-is. In practice this relies on the data being at least somewhat compressible, which might be an issue
In case of files primarily composed of redundant data, making 2 or more copies on the fly would still save a lot of space. Might be also useful for working in mixed SSD+HDD environments where less data would be written to the SSD and the HDD would hold copies of the files for safety.
I've personally been running ZFS with LZ4, where checksums handle corruption. Another upside is that LZ4 is fast enough to actually improve I/O throughput, since overhead is negligible. On my jail/container/vm datasets I've seen space reduction upwards 80%, with backup-datasets I've seen around 30% reduction.
Another possibility is data deduplication, which is useful if you have plenty of RAM. You can deduplicate across files on block level. However I have only used it sporadically due to the high ram usage.
With ZFS and LZ4 or LZ4HC you might get better compression, BTRFS is more lightweight though, so it's a great solution. I wonder if encryption would be possible in a similar way.
This approach is not a useful path to lower overall disk usage IMO because you need to thick provision the directory up front, with an estimate of overall compressed disk usage. That's a recipe for usability pain. Thin provisioning with sparse files won't work well with a COW tree structured backing store like btrfs either.
btrfs isn't journalled, but all the same, the issue is data integrity in a crash scenario. That will affect btrfs, and frankly, any other filesystem (for example ext2 or ext4-without-journal); imagine if an application depended on syncing files at certain points and the underlying storage stack decided to write out a "sync2" before "sync1" was written out.
How is this different than a chattr +c on the directory? I suppose the compress option doesn't force compression (so it will try to recompress compressed files).
39 comments
[ 2.8 ms ] story [ 97.8 ms ] threadEach of these datasets can have their own options set. So yeah it's basically the same thing as btrfs?
One of the benefits of NT's packet-driven I/O model (versus the UNIX synchronous VFS read/write blocking buffer I/O model).
It's useful as a workaround for 32-bit applications which aren't built with LFS (Large File Support) enabled, and because of that fail on large XFS partitions. It's a very common bug in games which come out in 32-bit only. Making a loop device is a workaround, but using sudo for it all the time is annoying.
Also, there is probably no need to explicitly create a loop device, unless you already used up all existing ones (see man mount):
I.e. in such case I simply create an empty file of certain size, then format it with some filesystem, and then mount it as a loop.For example:
Another possibility is data deduplication, which is useful if you have plenty of RAM. You can deduplicate across files on block level. However I have only used it sporadically due to the high ram usage.
He/She is hoping the 50GB's are enough since there are no calculations on the article.
This approach is not a useful path to lower overall disk usage IMO because you need to thick provision the directory up front, with an estimate of overall compressed disk usage. That's a recipe for usability pain. Thin provisioning with sparse files won't work well with a COW tree structured backing store like btrfs either.
Show HN is for something you've made that other people can play with. HN users can try it out, give you feedback, and ask questions in the thread.
This blog post is not a "Show HN" meterial.
Plase change the title to "Using BTRFS with loopback for compressed directories".