rsync backup script

There are many backup solutions available for Linux, several of them in fact using rsync under the covers. However none of them quite seemed to fit my requirements (or I didn’t dig deep enough into the options).

Instead I have put together my own shell script to back up my home directory. It takes advantage of Linux filesystems’ capability to give a single file more than one name (known as hardlinking), and rsync’s –link-dest option. In essence I have a hybrid incremental/full backup system, which only takes as long to run as an incremental system.

My main inspiration comes from this page by Mike Rubel. My script is available at http://funkyhat.org/stuff/scripts/funkybackup

Update (17-05-2010): The script now writes out the date of the most recent backup to a file if the rsync process completes successfully. This means that if a backup is interrupted part way through it won’t be used as the base for linking, so my backup space won’t get bloated artificially.

4 Responses to “rsync backup script”


  • This is neat, I might work this around a bit or add another script to tar and keep the past few backups that way. I don’t need full backups everyday forever, but it’s a sweet start.

  • hey matt, its mark henrick from BBC. i have been using rysnc to backup my home server with this command

    $rsync -avs –delete mark@192.168.1.6:/var/www /media/disk2/My\ Documents/backup/server.

    btw, do you maintain these servers yourself, or is it a professional company

    • That’s cool. The advantage to using a script like mine would be if you accidentally delete something you’d still have the backup of it from the previous day. After setting up my script someone told me that rsnapshot (available via aptitude) does almost the same thing and is easy to set up, so it might be worth having a look at that if you’re interested.

Leave a Reply