Search This Blog

Sunday 14 March 2010

Server setup - backing up with rsync

Now the server was built and OS configured, I needed to actually start using it.

The first stage was simple - a copy of the files from my Mac over to the server, and making photos, music, etc, available in shared areas so all machines could connect.

Going forward, the intention was to run a command that would backup changes to files. For this, I used rsync, and set up three basic commands:

First, for Music -

rsync /usr/bin/ssh -ave --stats --delete --progress --exclude /iTunes\ Music/Downloads/Podcasts/  ~/Music/iTunes/"iTunes Music"/ /Volumes/1tb/"iTunes Music"

This command copies everything in iTunes except the Podcasts folder. The --delete means that files deleted on the Mac are also deleted on the server.

Then for Photos -

rsync /usr/bin/ssh -ave --stats --delete --progress --exclude /iPod\ Photo\ Cache/ --exclude /iPhoto\ Library --exclude /Photo\ Booth/ ~/Pictures/ /Volumes/Mac_backup/Pictures/

Likewise, excluding some folders that are not required

and finally for other Docs - 

rsync /usr/bin/ssh -ave --stats --delete --progress --exclude /Downloads/ --exclude /Music --exclude /Pictures --exclude /Public --exclude /Sites --exclude /Dropbox --exclude /DWHELPER --exclude /Desktop --exclude /Library/iMovie --exclude /Library/Printers --exclude /Library/ --exclude "/Library/iTunes/iPod Software Updates" --exclude "/Library/iTunes Plug-ins" --exclude /Library/Fonts --exclude /Library/Colors --exclude "/Library/Application Support/iDVD" --exclude "/Library/Application Support/Aperture" --exclude "/Library/Application Support/" --exclude "/Library/Application Support/Adobe" --exclude "/Documents/Pictures alias" --exclude "/Documents/Drop Box alias" --exclude "/Documents/Movies alias" --exclude "/Documents/bin alias" --exclude "/Documents/iTunes Music alias" --exclude .Trash/ --exclude .dropbox/   --exclude "/Movies/Home Vids" --exclude "/Movies/Mac Ads" --exclude "/Movies/Madness - Total Madness Videos" --exclude /Movies/QPR --exclude /Movies/Morrissey --exclude /Movies/Radiohead  --exclude /Movies/Factory ~/ /Volumes/Mac_backup/

The aim here is to remove a number of areas that either change infrequently or just do not need to be backed up.

Currently, there are not backup scripts set up on other machines, purely because they are mainly used for web browsing or are themselves referring to files on the network.

The scripts are saved as .sh files in /Users/Bin