rsync usage

rsync backup over ssh

Using rsync is a really simple way of creating automatic backups of important data.

I try to keep all important information under the /home/ folder. To backup the contents of this folder to an external machine over ssh I use the following script. Here it is assumed that a ssh login account for user backup has been created with no passphrase (see e.g. WebserverInstallation).

#!/bin/sh
rsync -ae ssh /home/ backup@library:/home/backup/mini.lounge.se/home/
logger "/home folder synced to backup@192.168.0.1"

On my backup server I also do backups. On this server I dont want to backup the complete music library, which is excluded in the following script.

#!/bin/sh
/usr/local/bin/rsync --exclude='/home/share/music' -a --del --force /home /backup
logger "rsync /home (with exceptions) to /backup"

A call to these scripts are then added to /etc/weekly or /etc/daily to make synchronization automatic.

Incremental backup using rsync

Now I have switched to a fully incremental backup of each client.

Incremental rsync backup

References