<!-- 
.. title: Backup again
.. slug: backup-again
.. date: 2009-06-07 18:04:03 UTC+01:00 
.. tags: backup, 
.. link: 
.. description: 
.. type: text 
--> 

Here at home, I'm extremely happy with rsnapshot as a backup solution. It's exactly what I need: easy to configure (with just a few [pitfalls](backup-your-data.html)), totally transparent, and very reliable. Too bad I can't use it at work: the incremental backups of rsnapshot rely on hard links, which are supported neither by cifs nor by sshfs. And no, I do not want a server-based (pull) backup. I want to push my data!

We briefly thought about setting up nfs, but that requires kerberos for secure authentication ... oh well, that's really too much hassle for a lonely snake. I instead decided to search an easy-to-use backup program which does not require hard links. Easy to use, mind you: enterprise-class solutions of the like as bacula or amanda are explicitely ruled out.

And I think I found one: rdiff-backup, which realizes incremental backups via rdiff.

The configuration is simple:

	#!/bin/bash

	# http://www.gnu.org/savannah-checkouts/non-gnu/rdiff-backup/examples.html
	# http://wiki.rdiff-backup.org/wiki/index.php/Main_Page
	# http://wiki.rdiff-backup.org/wiki/index.php/BackupToSshfsMount
	# http://en.kioskea.net/faq/sujet-746-rdiff-backup-making-effective
	  -and-incremental-backups

	# Be nice to the hard disk
	ionice -c3 -p$$

	# Some variables
	source="/home/cobra" # directory being backed up
	destination="/mnt/home/rdiff" # directory backing up to
	excludelist="/home/cobra/bin/exclude_from_backup.txt"

	# Mount home (check your local uid and gid with id)
	sshfs username@server:/home/users/username /mnt/home \
	-o workaround=rename,uid=local_uid,gid=local_gid

	# Checking for old backups that need to be removed
	echo "Removing backups older than one month"
	rdiff-backup --remove-older-than 30D --no-hard-links --force $rdestination
	# For a list of the number and date of incremental backups, use:
	# rdiff-backup -l $destination

	# Start the backup
	echo "Starting backup"
	nice -n +15 rdiff-backup --print-statistics --no-hard-links --exclude-sockets \
	--exclude-filelist $excludelist $source $destination
	echo "Backup complete"

	# Unmount home
	fusermount -u /mnt/home

The exclude list might look like that:

	/home/cobra/.beagle/
	/home/cobra/.Mail/FalseNegs/
	/home/cobra/.Mail/Junk/
	/home/cobra/.Mail/Worms/
	/home/cobra/.Mail/trash/
	/home/cobra/temp/
	/home/cobra/tmp/
	/home/cobra/.opera/cache4/
	/home/cobra/.opera/images/
	/home/cobra/.mozilla/firefox/ytuudeoq.default/Cache/
	/home/cobra/.VirtualBox/
	/home/cobra/VMWare/

I've just started to use it, but so far it looks very promising. Ask me again in 30 days. 😊

What I will detail very soon in a forthcoming blog entry: how to automate this backup in the most convenient way.

