squashfs

I’ve recently been using squashfs for backups, rather than tar. The main advantage is that it can be mounted on the file system. If you’ve ever had to wait minutes or even hours waiting for tar to locate and extract a specific file, you will appreciate this. It also does de-duplication, which is a nice extra. I also used it to back up a multi-terabyte NAS, so it seems to scale fairly well.

mksquashfs /home/user `date +"%Y%m%d"`.squash -noappend -force-uid `whoami`

If you want to exclude a path, append:

-e /home/user/Music/

The force-uid part ensures that the current user is marked as the owner of the files in the squashed file system. Otherwise, they will be owned by root, which can be annoying.

Squashfs tools are also available on macOS via homebrew as squashfs, allowing macs the ability to squash and unsquash these file systems.

You can also use the unsquashfs tool to quickly list the contents, without mounting.

unsquashfs -l [filename]
unsquashfs -ll [filename]

-ll gives you a listing similar to ls -l.

Warning: Don’t use XZ compression! I lost several file systems that we’re compressed using XZ and are not readable. Possibly see: Xz format inadequate for long-term archiving.

More info: