(2016 Update: Some links are dead)
Update April 2013: Check out an easier way to do this. If that does not work, feel free to attempt the instructions below.
Apple’s Time Machine is designed to backup to external disks or Time Capsule network shares. It was discovered pretty quickly after it’s OS 10.5 release that any AFP share could be used as a backup destination, allowing one to use any AFP server as a destination for their Mac. The procedure has changed since, in 10.6, and 10.7. 10.8 fortunately works identically to 10.7, which I will quickly review:
- Use Disk Utility to create a new disk image to hold your backups. Name it whatever you want. Give it a size that it can expand to, it will automatically consume more disk space as necessary to hold backups until this size is reached (When the max size is reached, Time Machine will automatically start removing old backups). Use “Mac OS Extended (Journaled)” format, and optionally add encryption. I recommend you do, as you are keeping the backups on a network share and it shouldn’t impact backup speed. Set the Image Format to “sparse bundle disk image”. Save it directly to the network share for your backups.
- Open the disk image from the network share, and it should appear on your desktop. Using the terminal, type in
sudo tmutil setdestination "/Volumes/<volume name>", substituting in the name of the mounted backup disk image for
<volume name>, and hit return. Changing the Time Machine backup directory requires administrator privileges, which Terminal will ask you for.
- Using either the Time Machine menu bar item or system preference pane, run a backup. Time Machine will copy your backup into the mounted disk image as it works; open the volume to see a new “Backups.backupdb” folder with your saved data. Once Time Machine is finished, you can un-mount your backup volume and network share.
- The next time you want to backup, mount your network share and mount your backup image. Then, run Time Machine manually.
This alone is pretty handy, but having to manually mount your backups to run Time Machine is a waste of time. Fortunately, we can run
one command in the terminal to tell Time Machine to automatically mount the network share for us:
$ sudo tmutil setdestination -p afp://user@host._afpovertcp._tcp.local/NetworkShareName
To get this address, select the mounted network share in the Finder and Get Info (command-I). Under the General section, the address should be next to the Server section.
When you run the command, it will first ask for your administrator password (
Password:), then your destination password (
Destination password:). This is the password you use to connect to the network share.
After that, unmount your network share. If you are using encryption on your backup image, there is one more step: Open Keychain Access, and copy the disk image password from your keychain (default is
login) into the System keychain (by option-dragging or copy and paste). This allows Time Machine to mount the image without your keychain having to be unlocked.
Now try to run a backup manually. Time Machine will mount the network share in the background, and it will not be shown on your desktop. Your backup image will appear on the desktop while Time Machine runs, and will be ejected along with the network share when it is complete. You can connect to the share normally with the Finder while it is doing this, and it will not eject your share when it finishes. Now you can turn on automatic backups, and Time Machine will handle all the (net)work for you.
setdestination will cause Time Machine to rename your backup disk image to reflect the name of your current machine. This may interfere with your ability to backup multiple machines to the same disk image, which although possible, may not be such a good idea.)