Friday, January 22, 2010

How I backup my homedirectory

I use rsync in a bash script to backup my homedirectory

#!/bin/bash
userdir=`whoami`
computer=`hostname`
echo "backup User "$userdir "on Host" $computer "to net_storage"
rsync -av --exclude-from=.rsync/exclude --delete --delete-after --delete-excluded $userdir@net_storage:$userdir/rsync/$computer/ 

where:
userdir is the user of the folder to backup
computer is the host to be in the backup

You can have a file "exclude" where you can define files or folders not to be in the backup.
I exclude ISO files because they generate a lot of traffic and I also exclude cache files of browsers.

My backup System is a small NAS filer (mgb 111) with an extra firmware which is capable of ssh.