incremental backups with tar
This script uses GNU tar and gzip
to create incremental backups.
- copy the backup-script somewhere to in your path (e.g. /usr/local/bin)
- create a directory where you want to store your backup
- 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:
- optional: create a file `hostname`-X with all the exceptions:
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
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
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
all files that changed since the last backup are stored
- if no full-backup exists, it will create one
- if a full backup exists, it does an incremental
- the "*.incremental"-files are used by tar to save
information about the incremental backup
- filenames are stored without the leading "/" (and have to be restored this way)
- tar is sloooow.
download the backup-script
there is a wrapper-script
for cron. This
one has to be adapted to your needs.