Backup External Music Collection using Rsync
I've got a 1TB hard drive that I fill with music. It is the master copy of my music collection, e.g., I make all changes there and then backup the music to my home server. These changes include adding more music, encoding existing FLAC files to MP3, renaming files and folders, updating ID3 tags, you name it.
This is incredibly dangerous. If I were to lose or drop the drive my amazing collection would be outdated! So, I make sure to back up the files. For a while I would delete the files from the server and replace them all with the contents of the drive. That is, of course, super wasteful, considering 90% of the music will already be on the remote server when I go to backup. Rsync to the rescue!
This command will tell you what is happening when it happens, so that if it freaks out and starts deleting everything, you can stop it with Ctrl+C. I often rename things, so I want the old version of the file on the server deleted. I transfer files from my Mac to my Linux server, so both machines will need rsync installed, and the Linux server should have the SSH daemon running.
$ rsync --progress -avhe ssh --delete --exclude ".*" /Volumes/External/Music/ user@server:/storage/Music/
If you're like me, and using a Mac, it might be a good idea to update the version of rsync. To do this, you can use homebrew, and run the following command:
$ brew install https://raw.github.com/Homebrew/homebrew-dupes/master/rsync.rb
Unfortunately, homebrew doesn't include rsync by default, so you have to run that command to get it added. For some reason they don't want to add software which comes with OS X by default even though OS X Lion has 2.6.9 of rsync and the current version is 3.0.9.