So recently I’ve had to do some work on getting a NAS with a linux file-system to work with Mac OS X’s Time Machine.
To give some background on this, NAS stands for Network Storage Access and is basically a large hard drive (several) used as a network share, a cheap alternative to a server. Time Machine is Mac OS X’s backup and recovery solution to back up a machine’s data to a specific destination.
In this case the user’s wish was to back up their emails/ user files that were stored locally on the client machine to the NAS. Normally this would be a simple click of a button with Time Machine doing all the hard work of creating an image file and backing up to it. However when it interacts with a linux file system it runs into some problems.
This is an initial fix that allows the user to back up to the NAS, further problems are however as yet unknown (at least by me).
The way Time Machine works in a nutshell is that it creates an image file on whatever backup device you choose and then periodically (depending on the settings) rewrites this file to include any changes.
There are two problems here, first is that when Time Machine attempts to create the image file on the linux file-system based NAS, it fails. The solution here is to manually create an image file using disk utility, that is a blank image. The second is that Time Machine will not recognize the Linux file share as a valid backup drive.
Enable Unsupported Network Shares
- To force Time Machine to recognize the linux-based file system as a valid network share you need to enter the following command into a terminal (type it in and press enter):
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Mount Desired Network Share
- You need to mount the network share before you can use it for backups,
- When in finder go to: Go -> Server and click on “browse”
- Locate your network share and open it, this should mount it on the desktop.
- If it does not show up on the desktop you may need to go to finder -> preferences and tick “show all mounted network shares”
Finding the name of the backup image file to be created
There are two ways of doing this:
- Create it manually by knowing the standard, the name is in the following format: “<computerHostName>_<ComputerMacAddressWithoutColons>.sparsebundle”, so for example if on the network your computer is known as ‘zephor’ and its mac address is “00:A0:C9:14:C8:29″ your image name will be: “zephor_00A0C914C829.sparsebundle”.
- Or let time machine fail once, and use the system log to find the name of the file it was trying to create, I prefer this method as it ensures accuracy:
1. Select the network share as a drive for time machine to use as backup.
2. Initialise a backup by going to the toolbar and selecting “backup now”
3. When the backup fails open up a terminal and type in:
4. grep backup /var/log/system.log
5. Find the line in the output that shows when Time Machine is attempting to create and remember this (copy)
Creating the Blank Image: We first Create a blank image on the local machine using disk utility.
- Open Disk Utility
- Go to File -> New -> Blank disk image
Use the following values for the fields:
Volume Name: <name obtained from step 3.>
Volume Size: <Whatever maximum size you think your backup will reach>
Volume Format: Mac OS extended (journaled)
Encryption: (none)
Partitions: no partition map
Image Map: Sparse bundle disk image
Save this image file to somewhere on the local machine, somewhere you can access it. (I’d normally use the desktop) I saved as the same as the volume name for consistency.
Copying the Image onto the network share
- Your network share should already be mounted from step 2
- Copy your newly created image file (from step 4) on the network share
- NOTE: Make sure you copy the image FILE and not the mounted image folder (disk utility mounts the image automatically after creation), its a simple mistake but if you don’t realise it, it may take hours to troubleshoot.
Initialize backup
- Use the Time Machine Toolbar to initialize a backup by selecting “backup now”
Once the initial backup is complete (and this may take hours depending on how much data is being backed up) You should be able to use Time Machine as normal to do regular backups. These steps need to be taken on each Mac machine that is to be backed up on the network share.
These steps were based on information provided by:
http://www.readynas.com/?p=253
http://www.flokru.org/2008/02/29/time-machine-backups-on-network-shares-in-leopard/
and applying it to the situation. The NAS used was D-Link DNS 323