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 username@some.domain.com: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.

Tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use Markdown (surround code in `back-ticks`), or these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Subscribe without commenting