Backing up an OSX profile to a linux server with rsync
- By bed
- Wed 31 December 2008
TimeMachine is some nice software, but its overkill for me. I've previously written about this and how I put together a rsync solution and why I did so. In the case that anyone might be interested in doing the same, here is my setup.
Linux Server
I have a gentoo linux server, but this should
be a mostly generic rsync server setup. My rsyncd.conf looks like this
# /etc/rsyncd.conf
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
use chroot = yes
read only = no
uid = bed
gid = bed
hosts allow = 192.168.42.0/24
[bed-backup]
path=/mnt/backup/bed
comment = Beds Backup
and of course rsyncd is in my /etc/init.d and starts automatically at boot.
OSX
I have a simple bash script that I can run that will backup the contents of my home directory, called backup_bed.sh. This will turn sleep off, make sure the network is available (as the machine may have been woken from sleep) and then do the backup.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
I exclude non-essential stuff from my backup, notably temporary files and my virtual machines. These excludes are specified in the backup_excludes.txt file:
- .Trash
- Downloads
- temp
- Caches
- Parallels
And finally, the backup_bed.sh script is run every morning at 8am by launchd. The easiest way to configure launchd is with a nice GUI tool called Lingon. This is created as a User Daemon.
Finally my OSX is configured to automatically wake up a minute before the launchd runs (via System Preferences -> Energy Saver -> Scheduler). If for some reason the machine is actually off, launchd will run the script as soon as it can when the machine is next booted. (launchd is a very nice system).
One note of warning, this setup will not properly support Classic MacOS resource forks. These are nolonger used in OSX, however if you maintain a classic MacOS enviroment, you can backup to a OSX server (not a linux server) and use the -E option of OSX's rsync.