Back me up!

January 18th, 2009 by nils

After having months of sleepless nights because I wasn’t backing up my MacBook Pro, I finally decided that something had to happen. What made me hesitate for a while wasn’t so much the search for the right hardware but rather the fact that what i had in mind would be quite an investment. I didn’t want to go for yet another external hard drive because I thought the best solution would be a NAS that I can connect to the network and then access wirelessly from my laptop. Apart from relieving you from having to worry about dragging USB hard disks along when you move your laptop, a NAS with space for several disks also has the advantage that you can create RAID volumes and mirror your disks.

So after a lot of hesitation I settled for the Qnap TS-409 Pro and decided to start off with two 1TB Western Digital (Caviar Green WD10EACS) hard disks. This setup would allow me to start with a RAID 1 Mirroring Disk Volume configuration, effectively leaving 1 TB for use and mirroring the disks so I can be sure that even if a hard drive fails, my data won’t be lost. Later on I can still add two more disks to extend the capacity and I don’t even have to switch the 409 off for that. Another nice feature is that the TS-409 has three USB ports and supports automatic sharing of attached USB hard drives. This way I can continue using the external hard disks I bought before. So much for the server and hardware side of my NAS backup experiment. Lets look at the Software side.

The main scenario I want to be prepared for is a total system failure that requires me to restore or re-install my OS. So I needed a solution that writes bootable disk images and gives me a way to restore them. Since OS X provides a standard image format and the Disk Utility that you can start from the OS X installation disk and that enables you to mount and restore these image files, all a good backup tool needs to offer is a way to create both full and incremental backups. SuperDuper! does this and it is affordable, so I chose to try it.

It turns out that the free version of SuperDuper! enables you to write fully functional backups that you can mount or restore afterwards. By mounting them, you can browse your backup as if it was an actual physical drive. The only restriction of the free version of SuperDuper! is that it doesn’t support incremental backups. Since you’ll only need these later anyway and I was eager to get started, this was the perfect deal for me.

Up to here, everything went really smooth. But of course I wanted more. Since Leopard has Time Machine built in and it gives you such a nice interface to browse snapshots of your file system, I felt like it would be a good addition to SuperDuper!. In fact, on their web site, the developers of SuperDuper! even call it the perfect companion to Time Machine. The fundamental difference between the two is that SuperDuper! gives you a full backup that you can use to restore your system in case the hard disk fails or you mess up your system in some other way. Time Machine on the other hand creates hourly, daily and monthly snapshots of your files and provides an intuitive and simple user interface to browse them and restore them to previous states. I believe a sensable setup is to exclude all system files and basically only let Time Machine back up your data (Users directory) and leave the responsibility for system backups to SuperDuper!.

So much for the theory, but here comes the problem: Time Machine doesn’t support network drives. Luckily there is a simple solution for this. Open up a Terminal window and execute the following command

$ defaults write
TMShowUnsupportedNetworkVolumes 1

BTW, in case you are worried about messing up your system with this or not knowing how to revert it… the answer is simple

$ defaults write
TMShowUnsupportedNetworkVolumes 0

Seems logical, doesn’t it 😉

Afterwards you can open the Time Machine preferences in System Preferences and by choosing “Change Disk…” select your network drive. Unfortunately, that isn’t where the story ends though. After kicking off the first backup by selecting the Time Machine icon in the menu bar and then selecting “Back Up Now”, I got the error message “Time Machine Error – The backup disk image could not be created.” Luckily there is also an easy solution for this. We first need to look at whats happening here though. Time Machine seems to be creating an image file on the network drive. You can actually see the file being created but when Time Machine fails, it removes it. The name of the file that is being created contains the computer name, followed by an under score and the MAC address of the primary ethernet device (en0) without colons. Our workaround will be to manually create this file with the Disk Utility and then copy it over to the network drive we have selected in the Time Machine preferences.

So now you can either look up your MAC address by typing in “ifconfig” in the Terminal, looking for en0 and then checking what it says after ether or you can try to copy the file name while Time Machine temporarily creates the image file. Either way, you should end up with a file named <computer-name>_<mac-address-without-colons>.sparsebundle. Note that the .sparsebundle extension is added automatically by the Disk Utility. Now you just have to open the Disk Utility, click “New Image”, type in the image file name and select “sparse bundle disk image” as image format and set a reasonable volume size. The thing to keep in mind here is that the image file won’t initially have the file size you select here but will be able to grow to a maximum of this size. I actually found a very interesting and useful article about this here. After clicking “Create” and waiting a bit, the image file will be created and we can copy it over to the network drive. After starting a Time Machine backup by selecting “Backup Now” from the menu, I finally ended up with this…

I found quite a lot of discussions and hints about this topic on the internet. Here are the articles that really helped to solve the problem:

A thread in the apple discussion forum suggests that the Time Machine backup might fail when the computer name contains certain characters. According to the post, the following characters are safe to use in the computer name: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

I hope this is useful for some people. Have fun and feel free to comment!