« Stackoverflow DevDays London | Main | Code formatting in C++ Part Two »

Using a networked drive for Time Machine backups (on a Mac)

You'll find similar information to this around the web, but I find it fiddly enough to piece together reliably, and I need it often enough, that I thought I'd blog about it. That way it at least gives me a single place to look. Maybe it will help others too. Much of the specifcs, especially the hdiutil command line and the ifconfig trick, I sourced from this thread in the ReadyNAS forums. Note that the advice is by no means specific to ReadyNAS drives (I have a Thecus NAS myself). Many thanks to btaroli in that thread for the insight.

Time Machine

Time Machine is Apple's easy-to-use backup system, baked into OS X (as of Leopard). Unfortunately it doesn't allow you to back-up to a networked drive out of the box. Enabling this ability is pretty easy. Early on there were some reliability issues - which were largely due to the fact that Time Machine created a disk image (more specifically, a sparse bundle) on the network drive, and this was prone to corruption if the network connection was disrupted during a backup. I don't know if all the issues here have been entirely resolved now, but it does seem more reliable. Apple's own Time Capsule, which has been specifically designed to work with Time Machine, uses this same method, so it is no longer an entirely unsupported technique.

Enabling Time Machine for network drives

So how do you enable backing up to network drives? Open a terminal window and paste the following in (then hit return, of course):
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Mounted network drives will then show up in the list of destinations available for storing backups.

Getting a working disk image

Unfortunately this is not always enough. Often, after doing this, Time Machine will appear to start preparing a backup then fail with a cryptic error code. The error I have seen is:
Time Machine could not complete the backup.
The backup disk image "/Volumes/backups-1/Wall-E.sparsebundle" could not be created (error 45).
"Error 45"? What's that. If I try to create a sparse image myself in the same location I'm told, "the operation could not be completed". This is not much more helpful. If you google there are many references around to these errors - mostly in forums. Many of them are not terrible helpful, or require a lot of knowledge and/ or patience. I still don't really know what the problem is, although I suspect it's something to do with permissions and/ or attributes. Either way the solution generally seems to be to create the sparse image manually using a command called hdiutil. If you get this right then Time Machine will think it created it and just start using it. Simple eh? Well, it's not rocket science - but it does involve piecing a few things together. The name of the sparse bundle has to be something very specific which is made up from a few pieces of information unique to your set-up. I'll now take you through how to find those pieces of information.

Finding the Computer Name

We'll start with the easy one. The computer name. Specifically this is whatever the computer is named in the Sharing preferences. So open System Preferences, select "Sharing", and copy the name from the "Computer Name" section at the top.

Finding the MAC Address

This is the physical address of your network card (not your IP address, which is a logical address. Also the term "MAC" here is nothing to do with your Mac as a computer - it stands for Media Access Control address). Now you have to be careful here. Most macs these days have at least two network cards! You will probably have an ethernet port (for a network cable connection) as well as wifi. You may also have a USB based device, such as a mobile broadband device. Regardless of which one you use to connect to the network drive you'll be backing up to, the address we need is of the first network card (usually the ethernet port). If this seems a bit odd at first, consider the case where you usually connect over wifi, but to do an initial backup you connect by cable. If the backup name was dependant on the network connection used this wouldn't work. The address is only used to identify your computer. Anyway, it turns out there is an easy way to obtain this. Back in the terminal window, type the following:
ifconfig en0 | grep ether | awk '{print $2}' | sed 's/://g'
What's that doing? The short answer is "don't worry, it works". The slightly longer answer is that ifconfig dumps all the information it has about all it's ethernet ports. The first port is called en0, so the command ifconfig en0 dumps information about just that one. The pipe character, |, is the unix instruction for sending the output of one command to the input of the next. So we send the information from en0 to "grep ether", which filters out just the lines that have the word "ether" in them - which in this case happen to be where the MAC addresses are shown. To get that line into the form we need for our filename we pipe it to another command, awk, which just picks out the second part of the string, then finally to sed, which removes the colons. Phew. Like I said, it just works. Trust me.

Creating the sparsebundle

Now we have the information we need to create the name of the sparsebundle. Following is the instruction you need to issue to create it. Replace the <mac address> and <computer name> placeholders with the information we obtained above. You may need to change the size parameter (320g here) if you have a large drive to back up. The disk image doesn't take up that space to start with, but will grow up to the size you specify here, so use it to set an upper limit. Also you will be prompted to enter your admin password (sudo runs the command as SuperUser):
sudo hdiutil create -size 320g -type SPARSEBUNDLE -nospotlight -volname "Backup of <computer_name>" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/<computer_name>_<mac address>.sparsebundle
Note that this will create the sparsebundle on your desktop. Once there you can copy it to the desired location on your network drive (then delete from your desktop). This seems to be more reliable than creating it in place. Once you've done that you can start Time Machine and point it at the drive where the sparsebundle resides and it will find it and start using it. If this still fails, check that the name is exactly right and that you followed all the steps above carefully. Now sit back and relax, knowing that all your hard work is being backed up.

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Response: Time Machine OS X
    Time Machine OS X

Reader Comments (192)

Wow, even with simple instructions like this i'm always the last to get these things to work. Did I miss a step??

Last login: Wed Jun 29 01:26:31 on ttys000
Hydra:~ shilohwillcome$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Hydra:~ shilohwillcome$ ifconfig en0 | grep ether | awk '{print $2}' | sed 's/://g'
Hydra:~ shilohwillcome$ sudo hdiutil create -size 900g -type SPARSEBUNDLE -nospotlight -volname "Backup of <Hydra>" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/<Hydra>_<c82a14431347>.sparsebundle
-bash: Hydra: No such file or directory
Hydra:~ shilohwillcome$

June 29, 2011 | Unregistered Commenterhydra

@hydra Remove the angle brackets - they were just part of the placeholders

June 29, 2011 | Registered CommenterPhil Nash

Sorry I've not been able to keep up with replies to all the questions posted on here. Usually it means I don't have an answer anyway. I will continue to try and help out where I can but I'm not an expert here - most of the info I provided was pieced together from elsewhere.

I will try and update the main article to reflect some of the common misunderstandings I've been seeing here, though - so thanks for reporting them - it all helps.

June 29, 2011 | Registered CommenterPhil Nash

@Phil, thank you so much! I think it worked.
I'll be sure to pass on your gratuity in some form or another! I know of several forums having problems with this, i'll point them here.

Last question, I have a 3tb drive, but I put "size 900g" because I wasn't sure how to enter the TB range, how should I enter this? and should I enter the full 3TB or 1.5TB if I want to use the rest of the space for storage?

June 29, 2011 | Unregistered Commenterhydra

Ok, I entered "1500g" of my 3TB. I hope that works out ok.

June 30, 2011 | Unregistered Commenterhydra

Phil, my time machine backups to my WD MyBookWorld stopped working for no apparent reason although other Macs in the house continued working. After following your instructions my first backup in many months is powering away as I write this. Thanks so much to you and all your readers for their helpful responses.

June 30, 2011 | Unregistered CommenterNikki

Hi Phil

Can I do this on my Macbook Air? I don't have ethernet card, just Airport wifi card. Thanks!

June 30, 2011 | Unregistered Commentervotdfak

@votdfak yes, just hook it into your router and give it a try.

June 30, 2011 | Unregistered Commenterhydra


What do you mean "hook it in your router"? I said i don't have ethernet card. Can I do it using Airport wifi card? I've created spursebundle disk, moved it to my network share, but Time Machine cannot mount it.

July 1, 2011 | Unregistered Commentervotdfak

@votdfak AFAIK the instructions I have provided should work just as well if you have wi-fi only. The command that obtains the MAC address of your ethernet port should get the first one regardless of its type. For most Macs that will be the wired ethernet port - but in your case it should be the Airport card. My understanding is that this should be the way TimeMachine constructions the name too - so it should, "just work".

I used a few weasle phrases in there because I've not tried it myself. It should be perfectly safe for you to give it a go. It will either work or not. Please let us know what happens.

July 1, 2011 | Registered CommenterPhil Nash

Airport & Ethernet ID or MAC address are exactly the same. I always get to the point "Making backup disk available", after few seconds I get msg "The backup disk is not available.". Any macbook air users out there?

July 2, 2011 | Unregistered Commentervotdfak

Additional info. I can mount sparsebundle from network share, I can copy, move, open files/folders, but Time Machine doesn't work.

July 2, 2011 | Unregistered Commentervotdfak

Found it!!! Props goes to strawman from Macrumors http://forums.macrumors.com/showthread.php?t=773753

- connect the share via Finder Go -> Connect to server
- use the IP address instead of the network name for this share
- use a username/password which works with the default domain on the smb server, so don't use any domainname prefix
for the username
- don't click "add to keychain"
- afterwards connect the volume in TM as usual, as a new volume, and use the same username/password as above

It's is working!

July 2, 2011 | Unregistered Commentervotdfak

Hi Phil,
thank you very much!


July 11, 2011 | Unregistered CommenterDilong

Hi Phil

Thank you for all your helpful notes!
I am having the same issue as those lacking quotations. I get the error of only one image can be created at a time. When I put the quotations in, then the error goes away but I am not prompted for my password.

Any ideas? Also worth mentioning my computer name doesn't have any spaces to begin with...

July 12, 2011 | Unregistered CommenterDana

I have tried to follow this process and am still having the same problems: Time Machine spends a long time 'Making Backup Disk Available" but then returns the error message below:

sudo hdiutil create -size 320g -type SPARSEBUNDLE -nospotlight -volname "Backup of PGMacBookPro" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/PGMacBookPro_109add712f7e.sparsebundle

Here's what I got back when I typed in the sudo hdiutil command (including the command that I typed):

PGMacBookPro:~ phil$ sudo hdiutil create -size 320g -type SPARSEBUNDLE -nospotlight -volname "Backup of PGMacBookPro" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/PGMacBookPro_109add712f7e.sparsebundle
DIDiskImageCreatorProbe: interface 4, score -1000, CWOUDIFDiskImage
DIDiskImageCreatorProbe: interface 5, score -1000, CRawDiskImage
DIDiskImageCreatorProbe: interface 7, score -1000, CSparseDiskImage
DIDiskImageCreatorProbe: interface 8, score 1000, CSparseBundleDiskImage
DIDiskImageCreatorProbe: interface 9, score -1000, CCFPlugInDiskImage
DIDiskImageCreatorProbe: selecting CSparseBundleDiskImage
DIDiskImageCreateWithCFURL: CSparseBundleDiskImage
CBSDBackingStore::createProbe directory, not a valid image file.
DIBackingStoreCreatorProbe: interface 0, score -1000, CBSDBackingStore
DIBackingStoreCreatorProbe: interface 1, score 1000, CBundleBackingStore
DIBackingStoreCreatorProbe: interface 2, score 0, CRAMBackingStore
DIBackingStoreCreatorProbe: interface 3, score 100, CCarbonBackingStore
DIBackingStoreCreatorProbe: interface 5, score -100, CCURLBackingStore
DIBackingStoreCreatorProbe: selecting CBundleBackingStore
DIBackingStoreCreateWithCFURL: CBundleBackingStore
DIBackingStoreCreateWithCFURL: creator returned 17
DIDiskImageCreateWithCFURL: creator returned 17
DIHLDiskImageCreate() returned 17
hdiutil: create: returning 17
hdiutil: create failed - File exists
PGMacBookPro:~ phil$

I have to say that I don't have a clue what I'm doing. I moved onto a Mac about two months ago and was hoping not to have to get involved in this kind of thing!

Any help would be most appreciated.

@Phil While we wait for the clever one to arrive I had a quick look around ;-)

Seems like a relevant thread here:


Although not conclusive. One or two things in there you might want to try (such as the -ov option).

If you fix it please post back here for others who may have the same issue.

July 15, 2011 | Registered CommenterPhil Nash

@Dana Sorry - I don't have any answers there - but, again, if you find anything please post back here.

July 15, 2011 | Registered CommenterPhil Nash

A thousand thanks are not enough.
Well done and thanks for sharing!

July 23, 2011 | Unregistered CommenterAaron

This is quite possibly the best and most concise post that I have ever read. The Seagate Blackarmor NAS drives have built in Time Machine support, but it rarely every works 100%. I setup the NFS share only to find the aforementioned error. Your instructions worked without issue. Thanks for the post!

August 10, 2011 | Unregistered CommenterJesse C.

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>