How to create incremental and differential backups with tar - Linux Tutorials - Learn Linux Configuration

Tar (Tape ARchiver) is one the most useful utilities in the toolbox of every Linux system administrator out there. With tar we can create archives which can be used for various purposes: to package applications source code, for example, or to create and store data backups.

In this tutorial we focus on the latter subject, and we see how to create full, incremental and differential backups with tar, and more specifically with the GNU version of tar.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-create-incremental-and-differential-backups-with-tar
1 Like

first, THANK YOU for the tutorial of how to get my backups going on my new server! I was able to successfully start with Ubuntu Server’s sample grandparent-parent-child backup rotation script (ubuntu .com/server/docs/archive-rotation-shell-script) and transform it into a differential backup rotation script with this article! :pray:t3:

There is an errata in the article that needs to be fixed:

At this point we invoke tar again, but we reference the copy of the snapshot:

$ tar --verbose --create --file /mnt/data/documents0.tar --listed-incremental=/mnt/data/documents.snar-1 ~/Documents

needs to be changed to:

$ tar --verbose --create --file /mnt/data/documents1.tar --listed-incremental=/mnt/data/documents.snar-1 ~/Documents

or you would just overwrite the full backup.

Please let me know if I have misunderstood as the script I wrote with this change appears to be working the way you describe a differential backup to work (I’ll know on Saturday for sure after it iterates a few days and makes the next full backup!)