6

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?

3
  • 4
    covering all bases I see. – mikeserv Jun 24 '14 at 2:54
  • 1
    This question isn't opinion based; it's asking for an objective metric (compression ratio). – goldilocks Jun 24 '14 at 15:53
  • so I used tar so far, which is relatively slow – polym Jul 5 '14 at 23:42
1

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.

1
  • good point about the drawbacks and great example, I believe the reason why xz gained traction was because bzip2, while having a greater compression ratio than gzip, worked much slower – AnonymousLurker Nov 28 '18 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.