Monday, December 17, 2012

Time Machine on a network drive

Time Machine on a network drive

Apple’s Time Machine software made it easy to set up incremental back-ups, with one exception: network drives (more formally called network-attached storage, or NAS). Time Machine only directly supports drives formatted with Apple’s HFS+J file system, and will eventually use all disk space on the drive. This page provides an illustrated guide showing how to set up Time Machine on a network drive, using a sparse bundle to emulate a smaller HFS+J drive. Click ‘show screenshot’ after each instruction to see the relevant screenshot.
Note: Many network drives fail to function with Time Machine under OS X Lion due to Apple’s decision to require DHX2 authentication. These NAS devices are awaiting firmware updates from their manufacturers.

Preparation

1. Ensure the network drive is mounted:
1a. Click ‘Go’ and then ‘Network’ and double-click on your network drive. If your network drive is protected, enter your username and password. [show screenshot]
2. Find the name of your computer on the network:
2a. Open System Preferences. [show screenshot]
2b. Click the Sharing icon. [show screenshot]
2c. The computer name on the network is shown below the input field, with a ‘.local’ suffix which should be ignored (that is, if it shows stephenmorley.local then your computer’s network name is stephenmorley). [show screenshot]
3. Ensure Time Machine will show your NAS device:
3a. Click ‘Go’ and then ‘Utilities’. [show screenshot]
3b. Click the Terminal icon. [show screenshot]
3c. Type defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 and press enter. [show screenshot]
4. Find the MAC address of your computer:
4a. Type ifconfig en0 | grep ether and press enter. Your MAC address is the 17-character string consisting of six pairs of hexadecimal digits separated by colons. [show screenshot]

Creating the sparse bundle

5. Create the sparse bundle:
5a. Type hdiutil create -size 100g -fs HFS+J -volname "Time Machine" NAME_XXXXXXXXXXXX.sparsebundle and press enter, where NAME is the name of your computer on the network (as determined in step 2c) and XXXXXXXXXX is your MAC address (as determined in step 4a) without the colons. Ths will create a 100 gigabyte sparse bundle; to create a sparse bundle of a different size replace 100g with a different value. [show screenshot]
5b. Type rsync -aE NAME_XXXXXXXXXXXX.sparsebundle /Volumes/DRIVE/. and press enter, where DRIVE is the name of your network drive. This will copy the sparse bundle to the network drive, and will take several seconds. [show screenshot]
5c. Type rm -rf NAME_XXXXXXXXXXXX.sparsebundle and press enter. This will delete the copy of the sparse bundle on your computer. You can now close Terminal. [show screenshot]

Setting up Time Machine

6. Select the back-up location:
6a. Click the Time Machine icon and then Open Time Machine Preferences. [show screenshot]
6b. Click the Choose Backup Disk button. [show screenshot]
6c. Select the network drive and then click the Use For Backup button. Time Machine will show the drive’s full capacity, but back-ups will be limited to the size chosen in step 5a. [show screenshot]
7. Start the back-up:
7a. Time Machine will start the back-up automatically after two minutes. Alternative, click the Time Machine icon and then Back Up Now. [show screenshot]
7b. Time Machine will show a status of ‘Preparing…’ while it determines which files to back up. [show screenshot]
7c. After a few minutes the back-up will begin and the status will change to ‘Backing up’. [show screenshot]
7d. While the back-up is in progress, a volume called Time Machine will be shown on the desktop. Once the back-up completes, this volume will disappear. [show screenshot]