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: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

  • Marcus

    I have tried this and i get this message “The network backup disk does not support the required AFP features.” so im not sure what i am doing wrong

  • Alex

    that is all great except for mounting.

    I have a NTFS share on the network (\mypcM)

    I copied HFS myPro.sparsebundle to that share.

    I figured out how to mount the share:

    mkdir /Volumes/M
    mount_smbfs //user@mypc/M /Volumes/M

    How do I mount myPro.sparsebundle that is sitting on that M share?

    I need it to be mounted and appear in Finder in order to issue the following command:
    tmutil setdestination

    I used to have it all in one script on SnowLeopard that does not work anymore in MountainLion.

  • Dean

    Dont everything, terminal excepted commands, disc image is there for all to see – except time machine doe not see it!! I am running the latest at date of writing op system. tried everything, double checked and redid all your brilliant instructions but Time Machine jsut does not want to play, any suggestions?

  • Dean

    Should i add it here?
    Done everything, terminal accepted commands, disc image is there for all to see – except time machine does not see it!! I am running the latest at date of writing op system. tried everything, double checked and redid all your brilliant instructions but Time Machine just does not want to play, any suggestions?

  • Thorstein Johannessen

    This might be a long shot, but due to the lack of suggestions for solutions to this problem, I’ll answer here, so that anyone googling the error could check this issue (which is heartbreakingly simple):

    Make sure that you have ownership on the Backup drive you’re sharing! In my case I was able to read and write to it, I had in fact just reformatted it. But the permissions read “system”, “wheel”, and “everyone” instead of my user name. Add you own name, make yourself owner and voila, it works. No more error 13…

    EDIT: Command+I would give you the info panel with the permissions at the bottom. You’ll need administrator to change the settings.

  • Thorstein Johannessen

    I was in the same situation as you, googled “error 13” but found only frustration. Then I checked the permissions on the drive I was sharing, and they were “system, wheel, everyone”, instead of the usual “Administrators/Username, staff, everyone.”
    Add Administrators/ to that list and give yourself read and write permissions, this solved the problem for me.

  • Supreme Being

    OK – I’ve been using this for about a year now. Seems to work perfectly…

    But
    I recently had a hard drive failure and needed to restore from the Time
    Machine backup. First thing is, as mentioned below, when you want to
    recover from the backup Time Machine cannot see inside your ‘sparse
    image’ so you need to restore the image to a disk before starting the
    recovery process. This process took 9 hours since there was a lot of
    data on the backup (as is typical).

    After that the restore did not even work! Just get a no entry sign when starting up.

    I
    ended up having to clean install the OS and use Migration wizard to
    restore the data. Seems like migration wizard did not transfer
    everything since a number of things stopped working after the migration.

    So
    if anyone wants to use this backup method be warned – if you want to do
    a complete time machine recovery it’s gonna take some time and then may
    end up not working at all.

    I am going to find a new backup method. I would recommend that the author add appropriate warnings to this post.