I have looked around for a good backup tool. I have earlier used rdiff, but after mistakenly overwriting an impotent file, and not beeing able to restore it, as rdiff does not store previous versions of files. Therefore I found rdiff-backup, which uses the transfer technique from rdiff, only transferring changes, but furthermore keeps copies of older versions on the server. First we install the software with apt-get on both servers.
apt-get install rdiff-backup
As I mentioned in a previous blog post, I use a SSH tunnel to backup through [read more here http://debbox.dk/?p=30]. As I use a different port than the standard port 22, we must create a file named config in the folder .ssh/ in the home directory.
Now we are able to backup using the following command
rdiff-backup --print-statistics /home/ backup::/data/backup/ home/
On the server a copy of the /home directory is located in /data/backup. Furthermore a directory named rdiff-backup-data/ is found in the root, containing old diff data, to be able to recreate older versions.
To recreate older versions read more here http://www.nongnu.org/rdiff-backup/