
Andrew McGlashan wrote:
On 2/02/2013 10:57 AM, Trent W. Buck wrote:
I've mostly been using mksquashfs instead of tar for the last few years, because it preserves more metadata by default, offers better compression, and the result can be treated either as an archive (unsquashfs) or a filesystem (mount). On pre-squashfs systems, it builds out of git and runs fine without installation, only needs zlib1g-dev and optionally xz-dev.
What do you lose with tar when ran as root that you don't lose with mksquashfs ?
I don't remember offhand; possibly nothing. Glancing at the manpages, sparsefiles and xattrs appear to be possibilities. Incidentally, I got burned recently by rsync -a not copying xattrs, which meant that a web server lost its cap_net_bind_service=ep and wouldn't start up. mksquashfs defaults to packing as a tarbomb, but also defaults to extracting into ./squashfs-root (and refuses to act it if already exists), which is annoying for quick-and-dirty copies - for which I would usually use rsync or tar. One ridiculous gotcha is that squashfs regexp exclusion is per-dir, so mksquashfs x x.sq -regex -e usr/share/info/ actually needs to be written mksquashfs x x.sq -regex -e '^usr$/^share$/^info$/' ...otherwise it will exclude e.g. /usr/share/zoneinfo/. Also, mksquashfs reqires all arguments AFTER the sources and target; unsquashfs requires them all BEFORE. AFAIK -b 1M -comp xz -Xbcj x86 -Xdict-size 100% will give best compression (if you are including e.g. ARM binaries, add to -Xbcj). It does block dedupping and stuff. I thought about repeatedly appending to a squashfs rather than using rsnapshot, but it was all a bit too fiddly (-root-becomes ... is yuk; when it gets too big, you can't easily delete only the old snapshots).