How to Create a Time Machine Backup to a Network Drive in Lion

Let’s say you have a home NAS (Network Area Storage), a router with a hard drive, or even an old Windows machine with a lot of disk space lying around. You want to make use of this disk space to store your Time Machine backups. You open Time Machine Preferences and the only way you can add a non-local disk is via a Time Capsule or AirPort-connected storage. Now what? If this is your problem and you have upgraded to Mac OS X Lion, there is a workaround… Keep reading.

The reason why Time Machine Preference Pane doesn’t show network drive is likely the Mac Developer’s mantra: keep simple things simple and complex things possible. Novice users, by definition, are inexperienced — they’re likely haven’t gone through the pain of losing data and discounted the value of backups. Thus to not complicate things more and make it easy for most users (especially novices) Time Machine’s preferences only cater for the two common cases:

  • Directly-attached external storage (via USB, Firewire, or Thunderbolt).
  • Time Capsule or Airport Base Station attached storage.

But with Mac OS X 10.7, Apple have now made more advanced cases possible. As with most advanced stuff, you will need to open up Terminal to do it. The secret? The new tmutil command.

Back to the HOWTO. In order to create a Time Machine backup on a network folder  you need to follow these three steps:

  1. Create a HFS+ disk image, preferably sparse disk image, and place the disk image file into its destination folder/server where it will live. It shouldn’t matter whether it is SMB (Windows) or AFP (Mac) shared folder as long as your Mac can write to it.
  2. Mount the disk image and use the tmutil command to tell where is it. Make sure that the disk image is in it’s permanent home before you use tmutil (Also, don’t change the server name or shared folder name after Time Machine use it as your backup volume).
  3. Tell Time Machine to start the backup process to make sure it works.

Still not clear? Here comes the walkthrough

Creating the Disk Image

  1. Open Disk Utility
  2. Click on New Image
  3. Set a large enough size for the disk image. Ensure that the Format is “Mac OS X Extended (Journaled)” (in other words, this will be HFS+, the  Mac’s native filesystem) and the Image Format is “sparse bundle disk image“.

    Time Machine Disk Image Settings

  4. You can set Encryption if you want but not necessary. On the other hand, encrypting the disk image is a good idea since you’re going to put it on a network that can potentially be accessed by others.
  5. Save the disk image to the shared folder. Alternatively you can save the image locally and then move it to the destination folder on a server.

Tell Time Machine to use the Disk Image

  1. Open Finder
  2. Navigate to the shared folder which you put the new disk image.
  3. Double-click on the disk image to mount it. You should see the new volume in the Finder’s sidebar
  4. Open Terminal and enter the following command :
    sudo tmutil setdestination /Volumes/{mounted-disk-image}
    Be sure to replace {mounted-disk-image} with the appropriate name for your new disk image. You will be prompted for your password, this is normal.

Do a Test Backup

  1. Click the Time Machine icon in the Menu Extras area (that’s the upper-right side of the screen) and select “Back Up Now”.
  2. Wait for 10 minutes or so for Time Machine to do its thing
  3. Open Finder, navigate to the mounted disk image, and ensure that Time Machine have created the “Backups.backupdb” folder and there is a folder inside it with the same name as your computer.

So that’s just about it. You can also use this method to save backups to non-Mac drives, like NTFS drives, if you have the appropriate drivers installed to write to those filesystems (hint: MacFUSE+NTFS-3g or Tuxera’s NTFS driver). For more information on the tmutil command, type man tmutil at the Terminal.

Till next time, you take care.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

  • Doesn’t work, can’t create the disk image. :/

  • D M

    Yes it does.  Image created locally on desktop then copied upto share for backup.

  • Anonymous

    Works… kind of.  TM will backup, eject the disk image, and then can’t find it again.

  • James Rogers

    Really helpful, thanks 🙂 Create the backup to a external hard drive that has the sparse bundle on it, so will copy to network drive later

  • DominikKalisch

    Thanks for that HowTo. I searched for hours to do that but could just find the HowTo’s for snow leopard… But now it seems to work 🙂

  • I really appreciate this! Huge help. I’m having trouble creating the image. Every time I try it has the error: “Unable to create “Backup.sparsebundle. (Operation Not Supported)”

    I’m trying to create a backup for a MacBook running Lion on a home network to an external HD (NTFS) that is connected to a Windows 7 PC.  I’m trying to create a 150GB image.

    I’ve also tried to create the image locally and then try to move it to the HD, but when I do that it says the same error only with “(permission denied)”.

    I’m pretty new to working with mac (and with networking) – so I might have missed something obvious.  

    Any ideas?

    Thanks again!

  • Works great! But i have a question. Do i have to mount the NetworkBackup Disk manually all the time? I notice if double click the image the disk is mounted, then when Time Machine finish running the Disk is unmounted and the next time when Time Machine needs to run i need to double click the disk image again else it says disk not found. Is there a way i can make sure the disk is mounted all the time when ever i am connected?

  • Simon Coxshaw

    I have the same issue as Murali…

    As soon as the time machine has finished it’s back up it ejects the network drive and time machine will not back up until I mount the drive again manually by clicking on the sparse bundle disk image.

    Any ideas how I can stop this happening?

  • Yes, you need to mount the disk image each time. This is by design, as mounting the disk image is seen as equivalent to “attaching” the disk to the computer.

  • This is by OS X’s design and not an issue.

  • Hi, i’ve some questions.

    Should more than one mac use the same image disk ? Is there a mean to extend the size of the image disk later ?

    And finally, is there a mean, a script, a strategy in order than the disk image do not eject ?

    I want my Macs to mount the image at startup, and i do not want them to eject.

    I suppose that i can set a cron that check all hours if the disk is ejected or not, but if someone has an another solution … Thanks in advance. And good job for this tutorial.

  • jimimacknm

    Long live 10.7.4. The terminal window utility worked great. Time Machine seems to be able to find the disk image most of the time, even after restarts without
     manual mounting. Thanks. 

  • David Eckersley

    Yes it is an issue because it stops the time machine back up from being automatic. Whether by design or otherwise, that makes the back up process in-effective and therefore a major problem in my book.

  • nrama002


    Thanks for the well written guide. I use mountain lion OS on my macbook pro. My external hard drive is 1TB NTFS volume. I use it to backup my windows PC also so dont want to format it for now. I tried the above approach. I was able to create the sparse bundle disk image on my mac book. It opens well. But when I move it to my harddrive and try to mount it will unmount almost immediately. I have the latest OSX Fuse and Tuxera NTFS. Not sure why this happens. Without  it mounting I am unable to proceed further with Time Machine. Any help is appreciated. 

  • This worked great until upgrading to Mountain Lion. What is the key to get it work again?

  • Pingback: Mountain Lion: Time Machine over AFP, auto-mount edition | James Badger's Site()

  • Thomas Smets

    I upgraded to ML a few days ago & … I get the following result :
    Thomas-SMETSs-MacBook-Pro:repository tsmets$ sudo tmutil setdestination /Volumes/A3-SYSTEM/            Macintosh HD/         MobileBackups/        Time-Machine/         tsmets/               Thomas-SMETSs-MacBook-Pro:repository tsmets$ sudo tmutil setdestination /Volumes/Time-Machine/ sudo: cannot get working directory/Volumes/Time-Machine: Permission denied (error 13)The backup destination could not be set.

    Any Idea … ?

  • Nelson Yu

    Works like magic! Thanks for posting.

  • Is there a way to backup to a specific folder on the drive? It works like a charm to backup to the disk, however I’d like to backup to a folder on the disk. I tried to include it in the tmutil command line but it still backs up to the parent folder.

  • Thanks for this step by step guide, it works great, now I’m wondering how could I restore the backup if the system gets down?

  • Install the system from scratch (using an external drive or the recovery partition) then use Migration Assistant to restore your data and applications back.

  • Mathias Politschke

    Is this working with Mountain Lion or not?

  • I had a problem creating a sparse image directly onto a windows shared drive using the disk util but what I did instead was to create one locally, copy it across then resize it using the following command:

    hdiutil resize -size 750g hostname.sparseimage

    (750g indicating 750GB)

    This also has the advantage of fixing the size so that it doesn’t fill up all available space on the drive.


  • robinson654

    When enter the command into terminal, and type in my password, it comes up with this “/Volumes/MacMiniBackup: Destination does not support lock stealing. (error 45)
    The backup destination could not be set.” any idea how to fix this?

  • Hi, easy instructions (thank you), however it isn’t working and I was hoping you could provide guidance (I’m new to macs)…. I have my windows share mounted where I can see it in finder under Devices. When I enter the sudo tmutil setdestination /Volumes/MacAirBackup it asks for pwd, which I then enter my root pwd I set, but it says “Permission denied (error 13)”?? I’ve googled like crazy and can’t seem to find an answer… 🙁  Any ideas?

  •  Nevermind, I restarted from scratch and it looks like it worked! I mean, I can see it in the time machine list of disks to choose now, so I’ll try it…. thanks!

  •  Actually it didn’t work… It appeared to work because I created the sparsebundle on a usb connected drive…. when I moved the sparsebundle to my windows smb share location and mounted it, I still would get the original permssion denied error when using tmutil setdestination… oh well, I guess I’ll just use time machine with usb drive instead of smb share, as that seems to work.

  • Did you ever find a solution for this? I’m getting the same error.

  • Jayden Phillips

    I hope you realize it did this automatically since the start. Simply connect to the remote disk using finder then point time machine to it.  It will recognize this is a remote disk and create an image file on the disk.  It will also ask for the password to connect to the remote share. This way it automatically connects to and mounts the remote drive.  

  • IzzPop

    Thanks for the good instructions … I was able to get as far as creating the sparce image on my NAS Network Drive, which i can see in finder, but time machine does not list it as a backup disk to use … any help would be appreciated.  I’m using 10.8.2.  Would a potential problem be the NAS drive I’m using, its 8 years old and likely is formated NTFS. 

  • Is there a way to let the Disk Image file grow dynamically?

    Let say you start with a Disk Image of 50GB, and let it grow if it needs more space?

  • thanar

    Hello Jayden,

    Indeed, I’ve been using this method since day 1 Time Machine hit OS X, however setting this up was a bit painful then. However, since updating to Lion, this setup didn’t work right; for some reason the data rate was very low, took an hour to backup 50MB of data over Ethernet. I now switched the same image over to the method described here and it’s blazing fast, it does however unmoving after each backup, which is a pain in the ass!

    Also, could anyone please comment on why the hell is accessing the time machine volume so slow when the volume is automatically mounted by TM? The same volume works just fine if I mount it through the Finder! What am I doing wrong?

  • thanar

    I also have the same issue; mounting the image manually is not the way to go. Any other suggestions?

  • thanar

    You need extra software to be able to write to an NTFS drive from your Mac…

  • Works fine on 10.8.2. But I have to manually mount the image from the network drive. I must find out a way to automatically mount the image.

  • JRansomed

    To work around this, I setup a script to act as a watchdog. It checks to see if the image is mounted every 30 minutes and remounts it if it isn’t there. I’m writing something up about it on my wiki. I can post back here a link if you are still interested. I’d post in here what to do, but it explaining it thoroughly takes space and formating. I’m also writing up how to change the password of the image to something else as the script needs to know the password. I’ll explain how to run this from root’s crontab to help prevent unauthorized users from seeing the password. If they have access to root, this password is the least of your worries. (As I was searching for a solution to this problem I found this site. I never did find a solution other than to create the one I’m using.)

  • Hi, I’m very new to this but this is what I go after I did the “sudo tmutil setdestination /Volumes/Disk Image”

    “Usage: tmutil setdestination [-a] mount_point
    tmutil setdestination [-ap] afp://user[:pass]@host/share”

    What should I do next?

  • Please post link when ready, would be very useful. Thanks.

  • JRansomed

    Here’s a link to what I’ve got so far. I’m still hoping to find a nicer way to do this:

  • Very much appreciated! Thanks

  • JRansomed

    Glad I could help. 🙂

    I unfortunately had a SSD drive corrupt on me and discovered that recovery from a CIFS/SMB TimeMachine backup is not a straight forward process.

    Has anyone else tried to do this? What I ended up doing was mount the TimeMachine share from a working machine. Then restore the mounted volume to an external drive (which erases everything on that drive, but gives you a bootable backup volume with your data). Then boot the broken machine using an installer USB drive and selecting the option for recovery. That allowed me to select the external drive I imaged and attached to the broken system. This completely restored my system.

    Hopefully someone else has an easier way to recover from a total drive failure. I tried for hours to find a way to recover with the CIFS/SMB TimeMachine mount and couldn’t get it to work. Again, this is only a problem if your drive dies and you need to completely recover your system. I’ll end up putting some notes about this in the wiki article.

  • basilsalad

    Install a fresh copy of the OS and then use Migration Assistant to restore your data.

  • JRansomed

    I wish it were that simple. Migration Assistant wouldn’t show the mounted sparse bundle as a source. I can test from another machine to see if it will allow me to select it and report back. This was in 10.8

  • That is the purpose of a .sparsedisk image. You define the upper limit with you create it, but what gets created is a tiny fraction of the upper limit, and then it expands as needed. I created a 300GB image, that started out as a 1/2GB (400MB) file, then it expanded as more backups occurred. So… just be more generous when creating the initial image. Nothing to stop you from creating a 1TB image. It won’t take up that space until you need it.

  • JRansomed

    I’ve tested from a couple different machines. All of them seem to exhibit the same problem restoring. Has anyone else tried to run Migration Assistant against their backup? You can try run Migration Assistant on your current install . It won’t restore anything until you select what you want to restore from the backup. If you run into the problem I have, you won’t even get that far. The backup volume won’t be listed as an option for you to select.

    I have figured out how to make it work on my machines using dns-sd to trick Migration Assistant into believing it is discovering the Time Machine backup volume via a customized Bonjour advertisement for it on the network.

    If I’m the only one with the issue then there isn’t really a reason to write up anything on it. If Migration Assistant isn’t working for you and you’d like to try this workaround, reply to this comment. I’ll keep an eye out for it and work on writing something up.

  • JRansomed

    If you typed this as you have posted, I have to wonder if you didn’t name the disk image something other than “Disk Image”. Step 3 of the “Creating the Disk Image” had an option to name the disk image. Be sure and use this name in place of “Disk Image”. The disk image must also be mounted for this to work. If your name has spaces in it, quote the command like below:

    tmutil setdestination “/Volumes/volume with spaces”

    If this doesn’t work, hopefully we’ll get to the bottom of it.

  • coconutstudio

    This does not work with Mountain Lion. Sparsebundle image doesn’t seem to mount from network shares. (It was working on Snow Leopard)

  • calster

    @jransomed:disqus, did you manage to restore your files?

  • Matias Peruyera

    Hi. Do you think it’s possible to do a regular TM backup through USB and then move the Backups folder to that sparse image? The first backup via wifi is taking forever (10 hours for 32 Gb, and I need to backup an external drive too…). Thank you!

  • Marcus

    When i get up to the tmutil it will ask for a password. what password and i putting in. i have tried every password related to my mac and still nothing?