Time Machine backups on network shares in Leopard

This is a slightly shortened version of an article I already wrote in German which is my native language so please forgive me possible mistakes.

Mac OS X features in its newest release Leopard (Mac OS X 10.5.2 while I am writing this) an automatic backup solution called Time Machine. It automatically creates backups, takes care of everything and even incorporates a very stylish interface to find and recover old files.

Unfortunately Time Machine has some limitations. So far it only works with external hard disks that are connected directly to the Mac. Apple now provides a solution for network backups called Time Capsule. However, using already existing drives for backup would be desirable.

You can find guides to make Time Machine at least accept network shares as backup drives in the web. Using the command (all in one line)

defaults write com.apple.systempreferences
                      TMShowUnsupportedNetworkVolumes 1

in Terminal is sufficient. But this only results in accepting the share. At least in my case creating the first backup failed with the error:

Time Machine Error - The backup disk image could not be created.

Pretty dissatisfactory. We gonna need new solutions. In my investigation I often found the statement that Time Machine simply would accept self made disk images on the network share. It doesn’t.

It rather helps to investigate the failed backup attempt more precisely. You will notice that Time Machine tries to create a sparse bundle disk image on the share. It remains Time Machine’s mystery why that fails.

On Apple’s support forums you’ll find further advice. It is proposed to copy the bundle image while creation and to copy it back after this fails. Did not work for me. Anyway, the solution is much simpler. During the backup attempt Time Machine creates the bundle image on the share. This is called <computer’s name>_<string>.sparsebundle (Update: by the way, string is the MAC address of the local en0 device without colons). You should keep the exact name in mind (e.g. by copy & paste or by looking in Console or by constructing it yourself from computer’s name and MAC address).

Afterwards you start Disk Utility and create another “sparse bundle disk image” on your local drive. Volume Size should be the designated maximum size (see update 2) of the Time Machine backup (don’t be afraid, only by using the image it will increase in size). Further parameters: Volume Format - Mac OS Extended (Journaled); Partitions - No partition map.

After this use the exact name Time Machine assigned to its bundle image to rename your newly created image (if not already done while creating your own image). Finally you copy the image on the share and manually start a backup via menu bar.

Voilà. Afterwards Time Machine should start the tedious initial backup.

Update: Giving it a try I am positively surprised. After the successful initial backup Time Machine tries to create new backups every hour. And doing so it behaves very ideally. If the network share is not accessible (e.g. host is turned off) the backup simply will not be performed (and the user won’t be bugged with error messages). Nevertheless Time Machine continues to try to access it hourly. If the host comes online again new backups will be created. The needed share and disk image will be mounted automatically.

If you want to access Time Machine to recover files the automatic mounting will work as well. At first (in my case) the Spotlight index was broken. I don’t know why this happened, but I have created an article how to repair this index (currently only available in German).

On the network host which provides the share I have created a special backup user whose home directory contains the image. Fortunately, Time Machine has no problem if a user connects to shares on the host with his own user data.

Let’s face the drawbacks. Once a backup is created or Time Machine is launched the image will indeed be mounted but will not always be unmounted afterwards. Thus, users will have the image on their desktops. The connection to the share itself will also be kept established (but it is only visible by entering mount in Terminal).

Both isn’t necessarily bad if the share keeps being available. However, this does not have to be the case. If you want to disconnect image and share correctly from your Mac you’ll first have to unmount the image itself. Sometimes the system requires an admin password to do so. The share can only be unmounted by calling umount in Terminal. Supposably it will become problematic if the host is shut down while a connection is established or even a backup is in progress.

And of course bandwidth is a major drawback. If (as in my case) the Mac is a MacBook primarily using 802.11g WLAN and accessing the share on a Windows machine via SMB you surely should not expect too much from this solution.

Update 2: Things you should know about the maximum size of the image and the free space on the network share.

33 Antworten zu “Time Machine backups on network shares in Leopard”


  1. 1 john

    thank you for your blog - your advice helped me set up time machine on a NAS drive
    John

  2. 2 n[ate]vw

    Thanks for this information. Do you know if it is possible to do the first big (when it copies EVERYTHING) backup to a disk image on the same/local machine. And then afterwards copy the .sparsebundle over to the networked machine? I tried, but I could not get a local image to show up in the choice of where to backup.

    By the way, this in the .sparsebundle name is the MAC address of the network adapter en0. If you go to “Network Utility” and use the Hardware Address without any colons for the “Network Interface (en0)”, this is the string that goes after the computer name. (These may be different names under the German localization, but the “en0″ should be the same.)

  3. 3 flokru

    @n[ate]vw: I don’t know if that is possible, but I doubt it. At least it won’t work that easily. What could work: Make a backup on a locally attached drive (which will go into the drive itself and not into an image). After that move all files of the drive (including hidden files/folders like .com.apple.timemachine.supported or .Spotlight-V100) into a sparsebundle image (using mv in Terminal should cause no space problems as files are deleted right away after they are copied onto the image). Finally copy the image to the network host.

    I don’t know if it works and I doubt it will save time. You’d have to do a lot of work and copy the data over the network anyway. In my opinion the most convenient solution would be to just create the first backup over Ethernet and be patient.

    Regarding the MAC address. I knew that already but I just forgot to mention that while translating the article. This information has been added to the article.

  4. 4 EYKM

    This is great work!
    I’m impressed and I’ve got to say, I’m not so easily impressed.
    Got it down in first read and now backup is up and running.
    Waiting for the finish.

  5. 5 AndrewD

    Thanks Flokru! My first TimeMachine network backup is under way.

    My setup is a Synology DiskStationDS107e NAS appliance - essentially a Linux server supporting afp. My Mac is an iMac G5, obviously with 10.5.2. I don’t currently have a cable from my Mac to my router (though obviously the NAS appliance is cabled), so I am going to try the performance over 802.11g. It is slow as you pointed out, a Samba share has proved even slower.

    I would make one comment about your instructions. You say “Volume Size should be the designated maximum size of the Time Machine backup (don’t be afraid, only by using the image it will increase in size)”. I want to back up about 200GB eventually, but I only had about 30GB free local space. Disks Utility did not allow me to create an image bigger than my free local space, even though the image file is initially MUCH smaller - about 50MB! Do you have any idea how I could create a 200GB disk image file please?

  6. 6 flokru

    @AndrewD: I’m pretty sure I was able to create an image even bigger than the actual size of the drive on which I created it (it is an 80 GB MacBook and the image is about max 100 GB big).

    Any way, I tried to reproduce your problem and I got the same error. At least in my case the solution was extremely simple: Select “sparse bundle disk image” before choosing the maximum size. Hope this helps.

    However, I don’t understand how you were able to do your first backup on the NAS if creating the image wasn’t possible.

  7. 7 AndrewD

    Wow! Thanks for the quick response, and such a simple solution it didn’t even occur to me to try! I was able to create a disk image with a max size of 1TB, but which only takes up 300MB of space when empty. Mounting it just showed the free space on the drive. Whether this is a sensible strategy only time will tell, but Apple’s documentation says Time Machine will keep backups until your drive is full, and certainly the sparsebundle it tried to create got bigger than 300MB before failing.

    To ease your confusion, I got my first backup started using a 30GB image, by excluding everything except my users folder. I’ve cancelled that and started again!

  8. 8 Keith

    I was having this same issue using 10.5.2. I followed the directions except since you said to use the “same exact” name I removed the “.dmg” that came up after the sparseimage was created. This lead to the same errors I was having. Once I renamed it back to .dmg restarted and tried again it worked. It is backing up now and if it doesn’t work then I will let you know.

    Thanks for the tip.

  9. 9 Micheal

    Works great with windows share, Excellent!

  10. 10 NickM

    Thanks for the tip! Time machine worked perfectly using either an AFP or SMB share on my debian 4.0 linux server.

  11. 11 Corey

    thanks for the info! I got it working using the instructions above, but have hit a problem. After a period of time (hours, and gigabytes of data), the connection shuts down. Airport says I’m connected, but I can’t connect to the internet or my network shares. Have to reset the Airport to get connected again, and then my backup is incomplete.

  12. 12 flokru

    @Corey: That’s strange. This never happened to me. Though I have to admit that I made the first backup over Ethernet to save some time. I don’t know the reason for your problem, but if you ask me it sounds like a general network problem and not a Time Machine problem in particular (although actually I really can’t tell).

  13. 13 EYKM

    I have a complete backup but as you said before, “At first (in my case) the Spotlight index was broken.” you only have the instruction German, do you think you can translate it to ENGLISH for US, English speaking people.
    Thanks and really appreciate you for your work.

  14. 14 flokru

    I can do that, but I won’t be able to do so very soon. You can try if you understand Google’s attempt to automatically translate it (but I doubt it, Google Translate just does not work very well yet).

    In short: After deleting .Spotlight-V100 on the drive/image via

    rm -r /Volumes/<volume name>/.Spotlight-V100

    run

    mdutil -E /Volumes/<volume name>

    (both in Terminal with root privileges or via sudo). Hope this helps for now.

  15. 15 EYKM

    Thanks.
    But when I was done, the problem still persist. I don’t think that was the problem. I started Backing up Three days ago but whenever I enter Time Machine, it still show _Today, Now_ there is no way to go backwards in time — Just the now. How does that happen?

  16. 16 Michael J

    I tried the same, after the backup failed on a
    Thecus N4100. I get the error message “function
    not supported” when I try to create a sparse image.
    I have the feeling it’s an ext3 filesystem on
    the Thecus N4100 (tried a 200 char filename: no
    problems). But since someone reports that he got
    his mac backed up to his linux box, even that should
    work!?!?

    Any other tips? THANKS alot

    -Michael

  17. 17 John M

    Thanks for this information. I am very curious if somebody already tried restoring data from this because that’s what we’re all doing it for.

    Also, part of this solution (with the TMShowUnsupportedNetworkVolumes 1) is going around the net for a while. I was about to use it a while ago but then run into several issues from people saying that it’s OK until the drive fills up and Time Machine cannot delete the old backups (as it should). E.g. see:
    http://discussions.apple.com/thread.jspa?messageID=5918065#5918065

    Anybody tested this?

    Thanks,

    John.

  18. 18 andy fisk

    using steps above — but when I went to backup backups failed and I got a console message saying that it couldn’t create cookie .{mac address of machine}, I connected to my linux box switched to the timemachine directory touched the .{macaddress} file and chmoded it to 777 (might be over kill). Backup is running happily now.

  19. 19 flokru

    @EKYM: That’s strange. So you don’t see any previously made backups in Time Machine at all? In this case it is definitely no problem with the Spotlight index but rather a problem with Time Machine itself. In my case when the index was broken I could see old backups but I couldn’t use Spotlight in Time Machine. If I searched for a file that definitely existed in a previous backup Time Machine just did find it. If I chose the backup manually (because I knew where the file was) I could see and restore the file.

    @Michael J: Did you create the sparse image on your local drive or on the network share?

    @John M: I already restored several files with Time Machine over the network (although I have to admit that I only restored files I created only for the purpose of testing Time Machine). After repairing the Spotlight index even the search works perfectly.

    It is too late for me (around midnight here) to understand the problem in the thread you mentioned completely (I will look into it later). I have not yet experienced any problems with free space. Regarding my logs post-backup thinning (i.e. Time Machine deleting old unneeded backups) does work and frees up space in the sparse image.

    However, I agree with this (from your link):

    In any case, I would advise any SMB mounted partition Time Machine user to NOT rely completely on those backup.

    Time Machine over network is better than no backup at all. However, you should always be aware that it is not officially supported. Anyway, even a Time Machine backup on an external drive does not fulfill requirements of a really secure backup solution.

  20. 20 flokru

    @John M: I have read the support thread you mentioned and I think I do now understand the problem. However, it is a little sophisticated so I wrote a separate article about it.

  21. 21 AndrewD

    Hi, I notice that Apple has an update available titled “Time Machine and Airport Updates” version 1.0. Does anyone have experience of installing this, and does it affect behaviour for those of us using Time Machine on a (non Time Capsule) network share?

  22. 22 flokru

    I have installed it myself on our MacBook. Backups are still working. And it seems to me (I have not looked into this in detail) that Mac OS X is smarter in starting backups. After a longer period without backups I have noticed OS X starting a backup just after the network share became available (the hourly backup was scheduled for a later time). I don’t know whether this has anything to do with the update though.

  23. 23 Corey

    So I got it working…you’re right that it’s more of a network problem than a TM one; I tried it with SuperDuper and had the same problem. What finally worked was to do the initial TM “dump” using a wired connection. Now it’s working fine wirelesly!

  24. 24 Andy Max

    Solution with disk utility doesn’t work in principle. I have 200G Macintosh HD - one partition. When I try to create “New Image” it gives error “Unable to create resource busy”, suggestions?

  25. 25 ipguy

    when i create the sparse image on my desktop and then move it to the SMB volume, when time machine starts a backup, leopard creates a disk image, mounts it ansd starts the backup.

    should that be happening ?

    why is it creating a disk image on my desktop ?

  26. 26 Turbo Fredriksson

    Just one note: The MAC address mentioned is (always!) the ETHERNET MAC address! No matter if you’re backing up via the Airport…

  27. 27 AndrewD

    I suffered a logic board failure on my iMac G5, so I needed to do a full restore - for real! You’ll be pleased to hear that Migration Assistant running on a new Intel iMac (7,1 hardware) successfully read the time machine image from the network. One thing held me up for a while: I needed to mount the sparsebundle image manually first, so that Migration Assistant could find it.

    After that, it was a breeze. Only thing was, I had to restore my old account using a new username (migration assistant gives this option), as I’d already created a user with the same name. Minor problem though, compared to getting all my files, folders and settings back.

  28. 28 Joachim

    time-machine funktioniert nach Ihrer Anleitung, kommt aber jetzt (seit ich den Leopard 10.5.3 Update installierte) mit einem Fehler: “the backup disk image could not be mounted”. Ich benutze eine Lacie Ethernet Disk Mini (250GH). Gibt es einen guten Rat?

  29. 29 Elliot

    Fantastic post! After lots of trouble with “Disk image could not be created” problems, this has got my system working brilliantly. Thanks for your time in writing this.

  30. 30 Battambang

    Hallo Flokru! Thanks to you, I now have TM backups working to a linux/netatalk server.
    Un grand Merci!

  1. 1 Time Machine backups on network shares 2: possible problems auf flokrus Blog
    Pingback am 15. Mrz 2008 um 19:30
  2. 2 Time-Machine-Backups auf Netzwerkfreigaben unter Leopard auf flokrus Blog
    Pingback am 15. Mrz 2008 um 20:00
  3. 3 How to put a Adobe Lightroom catalog on a network share | Andre Crone - Elysia Productions
    Pingback am 24. Mrz 2008 um 16:09

Eine Antwort hinterlassen