Howto
Backing up your home folder with rsync
I have been looking for a way to mirror my home folder on my Macbook with a linux server (nslu2 with Unslung Linux in this case), this article describes how to do that with tools already available in Leopard.

I assume you have a valid SSH login on the server, I simply enabled my account on the NSLU2 and assigned the proper home and shell values to it. I also assume both computers have an working installation of rsync (run rsync --version to check)
For automatic, password-less logins, first we need to generate keys for SSH, if you have them already, skip this section. Run this command on your local computer:
$ ssh-keygen -d
Now copy your public key into ~/.ssh/authorized_keys2 on the server. If this file already exists on the server, you will have to edit it, if it does not (e.g. your account is fresh) first create the ~/.ssh directory on your server (mkdir ~/.ssh), then execute this command on your local computer:
$ scp ~/.ssh/id_dsa.pub yourname@yourserver:.ssh/authorized_keys2
Before we can start mirroring your home folder, we have to create a list of files we don't want to synchronize, this are the contents of my ~/.rsync/exclude file:
- .DS_Store - Virtual Machines.localized - Library/Mail Downloads - Library/Caches - Downloads/ - Applications/ - Books - anthill_cache - .Trash - .localized
That's it, now all you need to do is to adapt this command to your environment, run it and wait...
$ rsync -avzP --exclude-from=/Users/me/.rsync/exclude -4 --delete -e 'ssh -ax' ~/ you@yourserver:~/Backups/mymacbook/
you can also create a shell script so you don't need to remember the command everytime:
$ echo "rsync -avzP --exclude-from=/Users/me/.rsync/exclude -4 --delete -e 'ssh -ax' ~/ you@yourserver:~/Backups/mymacbook/" > ~/remotebackup; chmod +x ~/remotebackup
You can start the backup by executing ~/remotebackup
0 TrackBacks
Listed below are links to blogs that reference this entry: Backing up your home folder with rsync.
TrackBack URL for this entry: http://pugio.net/mt/mt-tb.cgi/322



I had to remove the "-4" from the command because it is not valid in rsync 2.5.5. Otherwise it works perfectly!
Running 'watch -d du -hs' on the host is fun...