Select Page

Recently I lost a bunch of data from a MacBook Pro that spun off of the corner of my sofa onto my hardwood floor. Ouch. My last backup had been about a month earlier so I lost some pretty important stuff I was working on at the time and had to spend hours mungeing the drive with various data recovery tools.

I decided once and for all to solve my backup problems. Any backup strategy that I would employ, fundamentally, would have to adapt to the fact that I am lazy and that I am a data packrat. Here’s what I did, and this will work for anyone with OS X or linux, half an hour, and a unix host somewhere that has RSYNC installed properly.

First, I created a dedicated backup account on my DreamHost box (“username”) and gave it shell/ssh access. DreamHost is one of the few services that gives you SSH and Web hosting on a non-dedicated box in my limited searching, but more importantly their basic package gives you 200GB of free storage, which blows away pricing from any of the dedicated OS X backup companies. To create the key and place it on the server I did the following:

From the Command Line (on my machine):

ssh-keygen -d
# hit enter three times and replace “hostname” with your own
ssh ‘test -d .ssh || mkdir -m 0700 .ssh ; cat >> .ssh/authorized_keys && chmod 0600 .ssh/*’ < ~/.ssh/ # enter your login password That sets up key-based authentication so that when sshing to the host in the future, it won't need my password. I then created a script on my local machine to back up the folders using rsync, one line per folder to backup. I find rsync extraordinarily complex to do actual syncing but when it comes to just pumping data out the back door on a regular basis, it's super-duper easy. Back to the command line and enter the following: mkdir ~/Scripts # makes a Scripts folder in your home directory cat > ~/Scripts/sync-all
rsync -a ~/Documents
rsync -a ~/Library
rsync -a ~/Projects
rsync -a ~/Movies
rsync -a ~/Music
^D # (that’s a control-D) … now you’ve created a script file that backs up those folders

chmod a+x ~/Scripts/sync-all
# fixes the permissions on the file

… later I wanted to get fancier and wrote a script that also recorded the time and logged each backup … just replace the content of your simpler script file (above) with this using any text editor:

date > ~/Scripts/sync-all.log
rsync -av ~/Documents >> ~/Scripts/sync-all.log
rsync -av ~/Library >> ~/Scripts/sync-all.log
rsync -av ~/Projects >> ~/Scripts/sync-all.log
rsync -av ~/Pictures >> ~/Scripts/sync-all.log
rsync -av /Applications >> ~/Scripts/sync-all.log
rsync -av ~/Incoming >> ~/Scripts/sync-all.log
rsync -av ~/Scripts >> ~/Scripts/sync-all.log
date >> ~/Scripts/sync-all.log

I then downloaded and installed LingOn, which lets you schedule and manage the rsync process via a GUI:





Here are some screenshots of the config process (this will rsync my Documents folder up to my Dreamhost acct every 10hrs, and do it as low priority so it doesn’t impact other things) but you can season to taste.

Enjoy! Hope this is useful. Thanks to Gersham for kicking this off.


%d bloggers like this: