10.5: Set up Time Machine on a NAS in three easy steps

Apr 25, '08 07:30:00AM

Contributed by: kuranuk

Here's a three-step process to create a Time Machine backup on a network-attached storage (NAS) unit.

  1. Create a sparsebundle image on your local system. I'm not sure of the reason why, but I haven't been able to kick Time Machine off just by specifying a network share. It "prepares" for a while, then says it was unable to create the disk image. The solution appears to be to create a sparsebundle image locally. Thankfully, you don't need multiple Macs like another post suggested; you can accomplish this using hdiutil like so:
    hdiutil create -library SPUD -size $SIZESPEC -fs Journaled HFS+ -type SPARSEBUNDLE -volname $MACHINENAME_$MAC_ADDRESS.sparsebundle
    Where $SIZESPEC is the size of the backup volume, and $MACHINENAME_$MAC_ADRESS is your Mac's name followed by an underscore and then your Mac's MAC Address (otherwise known as its Ethernet ID; visible in the Network System Preferences panel), but without the colons. So if your Mac is named MyMac, and the Network System Preferences panel lists your Ethernet ID as 00:18:b3:11:84:dd, then you would use MyMac_0018b31184dd for the name of the sparsebundle.

    The -size parameter can probably be as large as you want, now that Apple has evidently fixed the sparsebundle issues that were causing all but the most recent backup to be dumped. However, you can also specify a smaller size if you (like me) want to create a hard limit for the amount of space your Time Machine backups will take on your network drive. hdiutil does have a -resize option if you need to utilize that later.
  2. Create and set permissions on your network share. Just make sure you have read/write permissions set on whichever SMB/AFP share you're going to dump this to.
  3. Copy the sparsebundle to the network share root. Easy enough. Mount your network share and copy it over. I used this Terminal command after the MyBackup share was mounted: cp -r mymachine_0017f2c8426b.sparsebundle /Volumes/MyBackup/.
By this point, you should be good to go! Make sure you have read/write permissions on the network share, and that you've run the infamous defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1. Now just change your Time Machine disk to that network share, and you're off!

Personally, I'm using this on a custom Windows Home Server machine via SMB, so not only do I have the ease of Time Machine for my Mac, I have the copies stored on redundant disks using WHS's software-raid-but-not-quite Drive Extender technology (running on a low-power VIA C7, even!).

FURTHER READING:

Comments (33)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080420211034137