Now updated with all necessary information for 10.5.5!
I upgraded to Leopard with one of the main reasons being to take advantage of Time Machine.
My previous backup routine was to rsync important documents to a remote server on an hourly basis. Whilst this works well, it’s no good for large files like my iPhoto or iTunes libraries, and it relies on my choosing the right files to backup. It was also subject to network connectivity both on my Mac and the remote site — and keeping track of when the backup was working or failing was a pain in the butt.
Now I simply leave my Mac on for a while when I’m at home and Time Machine will make sure that everything is stored on my home network. I’m confident that the backup has worked as I can see the old data through the Time Machine interface. Large files are only copied when they’re changed and then only over my home network.
Although I’m using my wireless network for transfer (and the wireless router only does 802.11g not n), one of the surprises in this setup was that it didn’t take that long to do the first backup. I left it going overnight and it had finished another couple of backups by the following morning. This gives me confidence that if a machine goes completely dead, it won’t take more than a day to restore from scratch.
I’m using a QNAP TS-109 NAS box as my networked storage. It’s supposed to offer AFP sharing, but this doesn’t work yet with Leopard (the security requirements are stricter). Instead I use an SMB share which works fine.
Time Machine creates a sparse disk image on the NAS box, which it mounts and pretends is a local HFS+ disk. This approach has a few advantages: firstly, the Mac can use any fancy filesystem tricks it needs to in order to ensure that the backup is a true copy of what on my machine; and secondly, the image is compressed and so takes up less space on the NAS box. One disadvantage is that I can’t see the files when I log in to the NAS box directly — I have to mount the image on a Mac first. Another advantage is that Time Machine can create separate sparse images for each Mac to backup — so it’s easy to have multiple Macs backing up to the same SMB share.
I suspect that any home office NAS box would work just as well. I chose the QNAP as it has very good support (just check out their forum) and it doesn’t have a fan. Similarly, I chose a Western Digital Caviar GP 750Gb as the disk for its low noise output. When there’s nothing accessing the disk, the system is absolutely silent.
There were a few hoops to jump through to get this system to work:
- persuade Time Machine to see the SMB share as a Time Machine destination by activating the unsupported network drives feature -- simply open Terminal and type:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
- set up the NAS box with a quota per Mac so that Time Machine would know when to trim old backups (otherwise it just fills the NAS box with backups)
- create an appropriate Time Machine disk image locally and copy it to the NAS box -- see below
The first step does involve using unsupported features for my backup, but I thought I’d try it to see if it works — and I’ve had absolutely no issues for several months of continuous usage.
The second step is QNAP-specific, but involves creating a new user per backed up Mac. The QNAP interface then lets you set a quota for each user, which I set to about twice the disk size that was being backed up. The size of backup space that you need depends on how big your initial data is and how much it changes over time.
I’ve found that the Mac that houses my iTunes and iPhoto libraries had a big initial state but doesn’t change much, whereas the Mac that I use to work on and check my mail had less initial state but changes much more often. The compression done by the sparse disk images means that I may have overestimated the quota for each machine — I’m nowhere near the quota on either machine after over a month of backups.
Creating the disk image
To create the disk image, you'll need to find out two pieces of information about the computer you want to backup: its Computer Name and its Ethernet ID (also known as Ethernet MAC address). The Computer Name is the one that you set in the Sharing System Preferences pane. Open it up and you'll see it at the top. For the purpose of this example, let's say you've called your computer "Adam's Mac".
You can get the Ethernet ID from the Network System Preference pane. Open it up and click on the Built-in Ethernet network adapter (one of the items on the left). Then click on the Advanced button at the bottom right. Click on the Ethernet tab at the top of the resulting dialogue and the Ethernet ID will be displayed at the top. It should look something like "00:18:b3:11:84:dd". Note that you want the wired Ethernet ID even if you'll be using Airport to back up wirelessly.
The name of the Time Machine disk image that you want to create will then be "Adam's Mac_0018b31184dd.sparsebundle
", i.e. the Computer Name, followed by an underscore, followed by the Ethernet ID without the colons, followed by .sparsebundle
.
You'll have decided on a maximum size for the backup in the previous step and you'll need this again here. I use about twice the size of the disk that is being backed up.
Now go to Terminal and type the following commands (based on Mac OS X Hints):
DISK_IMAGE_NAME="disk image name"
DISK_SIZE=max backup size in megabytes
hdiutil create -library SPUD -megabytes $DISK_SIZE -fs HFS+J -type SPARSEBUNDLE -volname "$DISK_IMAGE_NAME" "$DISK_IMAGE_NAME"
In our example, the commands might be as follows:
DISK_IMAGE_NAME="Adam's Mac_0018b31184dd.sparsebundle"
DISK_SIZE=200000
hdiutil create -library SPUD -megabytes $DISK_SIZE -fs HFS+J -type SPARSEBUNDLE -volname "$DISK_IMAGE_NAME" "$DISK_IMAGE_NAME"
After you've run this command, you should end up with a disk image in your home directory called something like "Adam's Mac_0018b31184dd.sparsebundle
". It looks like a single file, but it's actually a directory (just like a Mac OS X application). Don't forget to copy this disk image to the appropriate share on your NAS box. Just dragging and dropping from the Finder should work fine.
Now make it work
To get Time Machine started, you follow these simple steps:
- connect to the NAS box share from the Finder using the machine-specific user
- open Time Machine Preferences and point to that drive as your backup destination
- make sure the "Show Time Machine status in the menu bar" option is checked
- click on the Options button in Time Machine Preferences and ensure that the "Back up while on battery power" checkbox is not checked (see note below as to why you want to do these last two steps)
- Click Done
Now sit and wait as your initial backup takes ages... You might want to let it go overnight as I did. Don't worry -- subsequent backups are much shorter as only the changed files are backed up.
There's one further step you can take to make wireless backup more effective. I tweak the Time Machine schedule so that my laptop doesn’t back up every hour — it’s not in the house all the time so I only really need it backed up once each evening. There's a really useful utility called Time Machine Editor that gives you much finer control over when backups happen. It's pretty self explanatory to use.
History and solved issues
This is the brand new updated page with all current information. Everything is currently working for me with no issues. However, there have been issues previously and if you've been searching around you may have come across them. This section is intended to put your mind to rest :-)
Creating the initial Time Machine image used to be automatic
The step to create the Time Machine disk image used to be done automatically by Time Machine itself, but something in OS X 10.5.2 stopped this. Now you have to create the image yourself as I've documented above.
Time Machine used to have problems when it ran out of space
When Time Machine fills up the backup disk it deletes the oldest backups to make room, leaving you with hourly, daily, weekly and monthly checkpoints. Until Apple released Time Machine and AirPort Updates v1.0, there was a bug that meant that all your old backups would be deleted when there was no more room on the disk. Obviously not what was intended!
See my blog entry on the Time Machine update, complete with proof from my logs showing that this issue has definitely been addressed.
Backup fails when interrupted by sleep
Five months in to using my wireless backup system, I had two backups fail on me in quick succession. It turned out that the Time Machine backup failed badly when the machine was put to sleep during the backup process. The failure was so bad that the backup image was irretrievable!
This is still an outstanding issue, as far as I'm aware, but there's a very simple workaround: don't put your machine to sleep while Time Machine is backing up. To help me in this, I've set the option to prevent backups when on battery power -- this is the most common time that I put my machine to sleep.
You can tell if a backup is progress because the little Time Machine icon in the menu bar rotates. Make it your habit to check that icon before you put your computer to sleep...