incremental backups with tar

This script uses GNU tar and gzip to create incremental backups.

installation

  1. copy the backup-script somewhere to in your path (e.g. /usr/local/bin)
  2. create a directory where you want to store your backup
  3. in this directory, create a file `hostname` (i.e. a file named like your hostname) with all the paths you want to backup. Here's an example:
    /etc/
    /var/lib/portage/world
    /usr/src/linux/.config
    /lib/modules/
    /wurscht/
    /root/
    /var/log
    /usr/local/portage
    /public/
    /home/
    /boot/
    /public/spiele/elasto/
    /opt/foldingathome/
  4. optional: create a file `hostname`-X with all the exceptions:
    /public/filme
    /public/freenet
    /public/spiele
    /public/movies/torrent
    /public/temp
    /public/burn
    /public/mldonkey
    /public/cvs
    /home/*/.galeon/favicon_cache
    /home/*/.galeon/mozilla/galeon/Cache
    /home/*/.pan
    /home/*/.phoenix
    /home/*/.mozilla
    /home/*/.thumbnails
    /home/*/.gnupg
    /home/*/tmp
    /etc/gconf
    /etc/sound

usage

To start a backup, change into the backup-directory and start the script.

The backups have to be restored in the order they were created, and you have to give the corresponding .incremental-file for every generation.
tar xzg herzeleid.07-04-16.incremental herzeleid.07-04-16-full.tgz
tar xzg herzeleid.07-04-18.incremental herzeleid.07-04-18.tgz
tar xzg herzeleid.07-04-19.incremental herzeleid.07-04-19.tgz
etc.

If you only need one file, the procedure is a bit easier. You can grep in the logfiles to find the archive the file is in, then just extract it without any special parameters. Only the file-list is incremental, all files that changed since the last backup are stored in full.

miscellaneous

download

download the backup-script
there is a wrapper-script for cron. This one has to be adapted to your needs.