
This work is licensed under a Creative Commons License. Commercial license available upon request.
Copyright © 2001-2005 Eric Pollmann.
I wrote this script to leverage many ideas I found when searching for backup strategies for the server I share and help admin. It runs every other hour, taking a rsync snapshot of the entire filesystem (takes ~2 min.). It preserves snapshots on an exponentially decaying schedule, with each snapshot double the age of the previous, for up to two years. That's 14 historical copies of the filesystem, each a perfectly usable, stand-alone copy. Through the magic of hard linking, they all fit in just slightly over the disk space of a single backup.
It is pretty configurable, allowing source, destination, decay schedule, number of snapshots, excluded files, logfiles (only latest copy kept), and backup device (remounted rw/ro during backups) all to be specified from the command line. It creates links in each users's homedir (~/.snapshots) to their corresponding homedir in the backup snapshot. It also has logic to list unique files, and sum the space consumed by each snapshot to provide some metrics.
To enforce readonly on the backup partition, I store it in an area that is only accessible to user root (and on a machine that has 2 disks, a partition mounted readonly), then export it over NFS, readonly, to /snapshots. To perform less frequent (nightly) off-site backups, I am currently using rdiff-backup. It seems to consume an inordinate amount of time though, so I might be switching back to my previous, simple rsync to an offsite location.