What is rsync?

Rsync is a program that can be used to backup your files. Much like Apple’s Time Machine, or syncing an iPod, it can be used to sync your data with a remote server, creating redundancy in your data to help keep it safe. By default rsync comes with Mac’s and most Linux distributions; I don’t know about Windows.

I set up a script to rsync all of my documents, pictures, music, etc to dataDyne (my raid). Rsync will check for differences in the local files (on my laptop) and the remote files (on dataDyne), and automatically sync the two computers. Rsync will transfer files over SSH so it is a secure connection; having SSH keys really helps here so it doesn’t keep asking for a password. Only changes I make on my laptop will affect rsync, so the files on dataDyne will match what files are on my laptop (one-way sync), much like the same way an iPod will match changes made to iTunes, not the other way around.

The music is sent to a Public directory on my raid, because it is [shared using daap][firefly].

The basics of rsync

rsync -av --delete -e ssh /home/user/personaldata user@server:/backup/
  • -a – tells rysnc to use recursion, and preserve the hierarchy of the folder you are backing up.
  • -v – tells rsync to be verbose, or show you every file that it is processing.
  • --delete – tells rsync, if I delete files on my local machine, those files should be deleted on the remote server on the next sync.
  • -e – tells rsync to use SSH as opposed to RSH.

  • /home/user/personaldata – this is the local folder that you would like to backup. I left off the trailing slash on the folder so rsync will copy the root folder (personaldata) as opposed to just the contents of the folder.
  • user@server:/backup/ – this is the remote location will the folder will be backed up to. User is your username, Server is the remote server, and /backup/ is the directory where the backup (personaldata) will be get stored.

Check the rsync man page for more information and more advanced options.