Setting up SMB/AFP/CIFS network drive for Time Machine on OSX 10.8 (Mountain Lion)

This took a short while to figure out, since most guides out there are written for pre OSX 10.7. I guess this should work for 10.7 and 10.8 and is a lot less effort than some of the solutions I’ve seen out there (thanks to the use of tmutil).

  1. create an encrypted local sparsebundle [code]
    hdiutil create -size 1g -type SPARSEBUNDLE -encryption AES-128 -nospotlight -volname “backup” -fs “Case-sensitive Journaled HFS+” -verbose backup
    [/code] which will create an AES encrypted backup.sparsebundle
  2. move the sparsebundle to your mounted network drive and resize it to the desired magnitude [code]
    hdiutil resize -size 300g backup.sparsebundle
    [/code]
  3. mount the sparsebundle (which is now on your network drive) locally on your mac
  4. The magic: tell timemachine to use the mounted sparsebundle as the backup drive [code]
    sudo tmutil setdestination /Volumes/backup
    [/code]
  5. Open time machine (behold: your backup sparsebundle is indeed selected as current drive) and start backing up. This should create a Backups.backupdb folder in the image and from here it’s just waiting.

Update:

http://trollop.org/2012/07/12/os-x-10-8-mountain-lion-time-machine-netatalk/#comment-957 reveals that there is a way to automount your sparsebundle. It amounts to using the following command in step 4:
[code]sudo tmutil setdestination afp://user:pass@host/share[/code], where of course user/pass and host/share should be adapted to fit your needs.

← Previous post

Next post →

15 Comments

  1. Love it – all working well, this had been causing me some grief until now.
    Although your first command didn’t work – I got an error:

    “hdiutil: create: Only one image can be created at a time.” It seems to be the -fs parameter that it doesn’t like.

    But I was able to create the Sparse Bundle in the Disk Utility GUI and follow the rest just fine.

    Thanks for your guide.

  2. Hey Jimmi, Glad it worked for you.
    It seems the problem you had is due to a wrong ascii character for the quotes (“) in that line. I changed that and now copy pasting it to terminal should work. Cheers for the correction!

  3. Hi

    I have tried this step by step, but I am getting error 45, when trying to run the “sudo tmutil setdestination /Volumes/backup” step. How can this be fixed?

    Thanks for the awesome work!

    Regards

  4. Hi Sigma,

    Could it be you’re using a NFS server/network drive? (http://trollop.org/2012/07/12/os-x-10-8-mountain-lion-time-machine-netatalk/ reports this as being a probable cause).

    Are you sure you have mounted the sparsebundle? I.e. is it visible on the lower right in finder as an ejectable drive?

    I tried googling for a solution, but couldn’t really find anything. I remember people proposing to use your network adapter’s MAC address as the name of the sparsebundle..

  5. 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?

  6. 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!

  7. 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.

  8. Hi!
    Finally, after several days browsing, someone who got it right!! Thank you so much. As for automation, is it necessary to mount the sparsebundle every time or will Time Machine do it? How would that work?

    • Cool, happy to help! For me (as long as the network drive the sparse bundle is in is connected) the bundle seems to be remounted by itself.

  9. Howdy!

    I held onto my 2009ish MBP until this week. That machine had run Snow Leopard for it’s entire service life (I had tried out Lion briefly and it sent me running for the hills).

    My work just bought me a shiny new Retina MBP (running Mountain Lion). The old machine has moved on to a well-earned retirement.

    The steps you list above work *pretty well*, but I have two problems, for which I don’t know if there’s a solution (none of this is meant to be a gripe about your process or your documentation… just hope there’s a solution to these additional problems).

    1) Time Machine does not auto-mount the remote .sparsebundle. I have to do that myself via Finder or Bash before TM wakes up and tries to run a backup. Under Leopard / Snow Leopard mounting & unmounting the .sparsebundle happend auto-magically.

    2) Under Snow Leopard, TM would fail silently any time it couldn’t locate the remote .sparsebundle (IE: any time I was at work or not at home). Under Mountain Lion, I get a pop-up once / hour informing me that my backup share can’t be found.

    Basically, it worked better, quieter, smoother under Leopard & Snow Leopard. Basic functionality is still there under Mountain Lion, but it’s a less rich user experience. Maybe someone has a fix for that?

    • > Time Machine does not auto-mount the remote .sparsebundle.
      seems according to http://trollop.org/2012/07/12/os-x-10-8-mountain-lion-time-machine-netatalk/#comment-957 that there is indeed a way using
      sudo tmutil setdestination afp://user:pass@host/share

      > Under Snow Leopard, TM would fail silently any time it couldn’t locate the remote .sparsebundle.
      I know, and the only way around it (that I know of and use) is disabling time machine from preferences

    • The issue of TM unmounting the sparsebundle was really bugging me too. I finally wrote a watchdog script to check and make sure the sparsebundle was mounted every 30 minutes. If the sparsebundle isn’t mounted, it mounts it. This stopped TM from having issues. Its not a pretty solution, but it works. If you are interested in how I did it, you can find more @ https://wiki.jransomed.com/OSX/NetworkShareTimeMachine

      I happened upon this blog as I was looking for an answer to the same thing. I really hope someone finds a way to stop TM from unmounting the sparsebundle.

  10. Worked perfectly, just spent a bit of time before mount image was double click the backup.sparsebundle file on the share.

    Thanks a million!

  11. Lorenzo

    Great, i’ve just started a Time Machine backup over a samba share with this trick, i’m running OS X 10.8.4
    Thank you!!!

  12. Trey McMeans

    Worked great! Thanks so much for the tutorial

Leave a Reply to Svein Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: