Blog

Incremental rsync backups

I’ve written a shell script to do incremental backups with rsync (inspired by this macosxhints article).

The script takes one or more sources, and a local destination path, and creates an incremental rsync mirror at the destination. It will first create an initial archive, then will subsequently create a new archive, hard-link the last archive in, and perform an rsync over it. Each archive will appear to be a full mirror, but will actually only use the disk space of the files that have changed, due to the use of hard links.

Here’s the script:

incremental_rsync.sh

And some uses of it:

incremental_rsync.sh [email protected]:www /Volumes/BackupDrive/Web incremental_rsync.sh Documents Pictures Library /Volumes/BackupDrive/Home

Note that old backups can be safely deleted without disturbing more recent backups; as hard links are used, the data won’t be deleted until all links that reference it are removed.

. Bookmark the permalink. Both comments and trackbacks are currently closed.