Back up key files via rsync and ssh

Jul 01, '08 07:30:00AM

Contributed by: Pat_Gilmour

If you find online backup solutions expensive and heavy on your system, you might be pleased to hear there is a cheap, easy way to create a mirror backup your Mac (or other UNIX variant) to a secure online server using a program named rsync. And as of Mac OS X Leopard, rsync will even transfer metadata associated with your files like tags and comments.

This method does not allow you to roll back to previous dated backups like certain backup solutions do (Time Machine, for example). What it does is create a mirrored backup of your Mac on a remote server, so it's best used in conjunction with a local hard drive-based incremental backup solution. Still, if the house burns down, your files will be safe and once you've done the initial backup, rsync is very efficient at keeping your remote backup mirrored with your disk.

In this example, we're going to backup the currently logged-in user's Documents folder.

What you'll need:

Procedure:
  1. Set up the remote server
  2. Set up your Mac
Some notes:
  1. If you want to check out what the -avz -e stuff does, take a look at the rsync man page.
  2. Your first backup can take hours, if not days (don't worry -- it'll be much faster the second time around, thanks to rsync's ability to transfer only the parts of files that have changed. Take a break from the computer and have a buy a real copy of this instead.
Deletes and Excludes:

One you've backed up your Mac's Documents folder using the method above, there will come a time when you will want to run the script again -- like when you add new content to your folder! However, you many also have deleted some content from your Documents folder. [robg adds: I use a variation on this technique (combined with password-free SSH connections and cron) to create a redundant offsite backup for certain critical data. I also use it to back up sensitive documents (financials, images of passports, etc.) after first writing them to an encrypted disk image. Some day, I'll write it all up in detail for posting...]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080701060927183