Cheap backups with Dreamhost + rsync

In my last post (I know, it’s been a while), I was gushing about how my hosting provider (dreamhost.com) was allowing 50GB of disk space for personal backups included with basic hosting plans.

The excitement was a bit premature at the time, because they only allowed backups via FTP. It instantly became problematic to regularly backup anything of significant size (i.e. 30 GB of MP3s) due to my lack of knowledge of doing incremental backups over FTP. If only they would allow rsync over ssh.

Apparently I was not the only person thinking this because the dorks of the internet united, Dreamhost listened, and today I got the monthly newsletter letting me know that rsync, scp and sftp were enabled….Sweet!

So I got crackin’ tonight on my new solution, which is thus:

1. Super-simple backup script (offsiteRsync.sh)

#!/bin/bash

# Sync the local directory to the remote server, limiting the
# upload bandwidth to 10KBps
# Sync via ssh and compress the files over the wire
rsync -avz -e ssh --delete --bwlimit=10 /Users/eric b159xxx@backup.dreamhost.com:~

2. Setup ssh keys so I can run the above script via cron..

lenny:~ eric$ ssh-keygen -t rsa

After typing the above in, I hit enter twice to accept the default directory for the keys and to choose a password-less key

Then I just copied the last (or possibly only) line from .ssh/id_rsa.pub on my local machine (lenny) to the .ssh/authorized_keys file on the remote machine (backup.dreamhost.com)

3. Test!

4. Setup the whole mess via cron, as noted in my previous post.

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: