by metadat · 4y ago · 0 comments
For read-only long-term filesystem-like archives, use squashfs with whatever compression option is convenient. The cool thing about squashfs is you can efficiently list the contents and extract single files. This is why it's an ultimate best option for long-term filesystem-esque archives.
https://en.m.wikipedia.org/wiki/SquashFS
For everything else, or if you want (very) fast compression/decompression and/or general high-ratio compression, use .zstd.
https://github.com/facebook/zstd
I've used this combination professionally to great effect. You're welcome :)
Incidentally, the author of the head article also disapproves of the format (not compression) design of zstd[1] on the same corruption-resistance grounds (although they e.g. prohibit concatenability), even though to me the format[2] seems much less crufty than xz.
[1] https://lists.gnu.org/archive/html/lzip-bug/2016-10/msg00002...
I wholeheartedly agree! That use-case is not currently covered by any widely known OSS project AFAIK.
I call it SITO and it's based on a stream of messagepack objects. If folks are interested in such a thing, I can post what I have currently of the spec, and I'd love to get some feedback on it.
I agree that TAR is problematic, compression is problematic, and there needs to be a mind towards ECC from the get-go.
I could really use some technical discussion to hammer out some of the design decisions that I'm iffy about, and also hone in on what is essential for the spec. For example, how to handle seek-indexing, and whether I should use named fields vs fixed schema, or allow both.
Like zip/7z (with external error recovery), or maybe RAR (with error-recovery records)
Fast compression or decompression is almost entirely meaningless in that context, and compression ratio is also only of secondary importance.
This is why PDF is still considered the best format for long-term archiving of documents, even though there might be things that compress better (djvu/jp2)
Personally I use 7zip for compression and par2[0] for parity.
0) error-correction (not just detection!)
1) end-to-end encryption
2) deduplication
3) compression
4) cross-platform implementations
5) (at least one) user interface
6) open source
Both Borg [0] and Restic [1] have long standing open issues for error-correction, but seem to consider it off strategy. I find that decision kind of strange, since to me the whole purpose of a backup solution is to restore your system to a correct state after any kind of incident.My current solution is an assembly of shell scripts that combine borg with par2, but I'm rather unhappy with it. For one, I trust my home-brewn solution rather faintly (i.e. similar to `don't roll your own crypto` I think there should be an adagium `don't roll your own back-up solutions`). In addition I think an error-correcting mechanism should be available also for the less technology-savvy.
I mean I can guess it works pretty well for single-bit flips, but how about burst errors, how long can those be? Usually you want to have protection from at least 1 or 2 filesystem blocks, which can be 4 or 8k or even more, depending on the file system. How about repeating error patterns, data deletions, etc.?
What’s the story look like around reading files out of squashfs archives stored in an S3 compatible storage system? Can what you mention above be done with byte range requests versus retrieving the entire object?
"DwarFS compression is an order of magnitude better than SquashFS compression, it's 6 times faster to build the file system, it's typically faster to access files on DwarFS and it uses less CPU resources."
Went ahead and submitted, I think it deserves its own discussion:
Some comment here says that the author of the article disapproves zstd with similar arguments as for xz. Have not verified the claim.
>Xz does not provide any data recovery means
For the common use case of compression a tar archive, this is a critical flaw. One small area of corruption will render the remainder of the archive unreadable.
I don’t know how we found ourselves with the best formats for data recovery/robustness fading into obscurity - i.e lzip and to lesser extent bzip2. The only compressed format left in common use that handles corruption is the hardware compression in LTO tape drives
Because monotonically increasing technological progress is a commonly-believed fairy tale. Nowadays, capabilities are lost as often as they're gained. Either because the people who designed the successor are being opinionated or just focusing on something else.
You can test by intentionally corrupting a .zstd file that was created with checksums enabled and then watch as zstd happily proceeds to decompress it, without any sort of warning. This is the stuff of nightmares.
After all these years, RAR remains the best option for archiving.
echo 'a b c' > test
zstd test
zstdcat test.zst
sed -i s/a/b/g test.zst # corrupt the file on purpose
zstdcat test.zstIt can also compress more than xz with tweaks, though I don't know the compute/memory tradeoffs.
[0] https://archlinux.org/news/now-using-zstandard-instead-of-xz...
Edit to fix typo.
The problem is that xz has kind of horrible performance when you crank it up to the high settings. On the medium settings, you can get the same ratio for much, much less CPU (round-trip) by switching to zstd.
YMMV, use your own corpus and CPU to test it.
$ time xz -9k m4-1.4.19.tar
real 0m2.928s
user 0m2.871s
sys 0m0.056s
$ time zstd -19 m4-1.4.19.tar
real 0m3.411s
user 0m3.380s
sys 0m0.032s
$ ls -l m4-1.4.19.tar*
-rw-rw-r-- 1 john john 14837760 Jul 24 14:40 m4-1.4.19.tar
-rw-rw-r-- 1 john john 1674612 Jul 24 14:40 m4-1.4.19.tar.xz
-rw-rw-r-- 1 john john 1726155 Jul 24 14:40 m4-1.4.19.tar.zst
In this test, XZ was both faster and had better compression than Zstd.That is a very small file.
See: https://news.ycombinator.com/item?id=25455846#:~:text=xz%20o....
> xz on highest (normal) compression level easily beats the compression ratio of zstd on highest compression level (--ultra -22) on any data I've tested. However with xz reading the compressed files easily becomes a bottleneck, zstd has great read speeds regardless of compression ratio
I've never tried lzop or met someone who advocated to use it. Needs research, perhaps. Until then I'm healthily skeptical.
I've also used it especially when resources are constrained (low performance CPU, ram, or when executable size really matters)
For a couple of years now I have switched to zstd. It is both fast and well compressed by default in that use case, no need to remember any options.
No, I have NOT done any deeper analysis except a couple of comparisons which I haven't even documented. But they ended up in slight favor of zstd, so I switched. But nothing dramatic making me say forget lzop.
Edit: NOT
Is there a way to extract the files without mounting the filesystem?
I believe 7z can do that as well.
I have never really seen it in the Linux world. There are several alternatives installed in most distros, all except zstd discussed in the article.