Backing up your Mac on an external disk

A couple of weeks ago, I needed to backup my MacBook Pro to an external disk (a firewire G-Drive) because my hard drive was failing. I started shopping for a good backup solution, but none of them had the following features:

  • support for incremental backups: if a change is made, you only backup the files that differ;
  • adequate handling of IO errors (no all-out abort);
  • inexpensive.

Indeed, I tried two different tools, but they refused to backup my disk due to numerous IO errors. They would not even tell me how to fix my problem.

As it turns out, your Mac has already all it needs, by default, to do just that. First, create a file called “backup.sh”, make it executable (chmod +x backup.sh) and copy the following content to it:


#!/bin/sh
RSYNC="/usr/bin/rsync -E"
# my external disk is located
# at /Volumes/G-DRIVE\\ MINI/
sudo $RSYNC -a -x -S --delete --exclude-from backup_excludes.txt $* /Volumes/G-DRIVE\\ MINI/
sudo bless -folder /Volumes/G-DRIVE\\ MINI/System/Library/CoreServices

Then run it! Go to a shell and type “./backup.sh”. It will ask for you root password.

If you ever need to restore your files, then create a file called “restore.sh” with the following content:


#!/bin/sh
RSYNC="/usr/bin/rsync -E"
sudo $RSYNC -a -x -S --delete --exclude-from backup_excludes.txt $* /Volumes/G-DRIVE\\ MINI/ /Volumes/Macintosh\\ HD/
sudo bless -folder /Volumes/Macintosh\\ HD/System/Library/CoreServices

Executing restore.sh may prove dangerous. Make sure you have tried booting from the external disk first. To boot from an external disk, I think you have to hold down the command key while rebooting.

4 thoughts on “Backing up your Mac on an external disk”

  1. Daniel,

    I have been using rsync to backup at work, with a different set of options (-Cavuz); I’ll check the options you use.

    I actually put the command in a Makefile so I just “make backup” every now and then.

    Have you figured out a way to automate the backup? I experimented a bit with Automator and Calendar but never could make it work properly.

    At home I use Retrospect Express, which came free with an external disk I bought. It does reasonably good incremental backups, but I find it quite slow.

  2. # my external disk is located
    # at /Volumes/G-DRIVE\ MINI/

    OK… how do I find out where *my* external disk is located?

    (p.s. related to the math question – I’m not so good at addition – heh)

Leave a Reply

Your email address will not be published. Required fields are marked *