Command-line incremental backup tools

backupcommand linecompression

Which command line backup tool(s) has the best compression ratio? I want to backup my entire system, including media files, text files etc.

I found this list on the Arch wiki site but I don't know how these tools compare to each other and which one would offer the best compression ratio overall. I realize that different tools might give better results for specific file types, but which tool and using which settings would result in the smallest archive given a mix of various input files?

Best Answer

The highest compression ratio also has some important drawbacks and is usually not recommended.

For a backup solution, it is often important to have a fast restore.

The compression ratio you are able to achieve depends on your data and the compression tool you are using. xz provides one of the highest compression ratios:

xz -z -c -9 -e /dev/sda2 > /path/file.xz

will compress your disk device to stdout (-c) with the highest compression ratio (-9) and the extreme switch (-e). This will take a very long time.

Another way to have good compression ratios and also a fast restore is using a compression-enabled file system like BTRFS, where you can store for example rsync backups.

To mount a compressed BTRFS volume:

mount /dev/sda2 -t btrfs -o noatime,nodiratime,compress=lzo /path

This is pretty convenient, because you don't need to deal with compression (it is automatically done by the filesystem) and have fast access to your backed-up data.

Related Question