Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.5: Set up Time Machine on a NAS in three easy steps Network
Here's a three-step process to create a Time Machine backup on a network-attached storage (NAS) unit.
  1. Create a sparsebundle image on your local system. I'm not sure of the reason why, but I haven't been able to kick Time Machine off just by specifying a network share. It "prepares" for a while, then says it was unable to create the disk image. The solution appears to be to create a sparsebundle image locally. Thankfully, you don't need multiple Macs like another post suggested; you can accomplish this using hdiutil like so:
    hdiutil create -library SPUD -size $SIZESPEC -fs Journaled HFS+ -type SPARSEBUNDLE -volname $MACHINENAME_$MAC_ADDRESS.sparsebundle
    Where $SIZESPEC is the size of the backup volume, and $MACHINENAME_$MAC_ADRESS is your Mac's name followed by an underscore and then your Mac's MAC Address (otherwise known as its Ethernet ID; visible in the Network System Preferences panel), but without the colons. So if your Mac is named MyMac, and the Network System Preferences panel lists your Ethernet ID as 00:18:b3:11:84:dd, then you would use MyMac_0018b31184dd for the name of the sparsebundle.

    The -size parameter can probably be as large as you want, now that Apple has evidently fixed the sparsebundle issues that were causing all but the most recent backup to be dumped. However, you can also specify a smaller size if you (like me) want to create a hard limit for the amount of space your Time Machine backups will take on your network drive. hdiutil does have a -resize option if you need to utilize that later.
  2. Create and set permissions on your network share. Just make sure you have read/write permissions set on whichever SMB/AFP share you're going to dump this to.
  3. Copy the sparsebundle to the network share root. Easy enough. Mount your network share and copy it over. I used this Terminal command after the MyBackup share was mounted: cp -r mymachine_0017f2c8426b.sparsebundle /Volumes/MyBackup/.
By this point, you should be good to go! Make sure you have read/write permissions on the network share, and that you've run the infamous defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1. Now just change your Time Machine disk to that network share, and you're off!

Personally, I'm using this on a custom Windows Home Server machine via SMB, so not only do I have the ease of Time Machine for my Mac, I have the copies stored on redundant disks using WHS's software-raid-but-not-quite Drive Extender technology (running on a low-power VIA C7, even!).

FURTHER READING:
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[139,579 views]  

10.5: Set up Time Machine on a NAS in three easy steps | 30 comments | Create New Account
Click here to return to the '10.5: Set up Time Machine on a NAS in three easy steps' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
But does it work?
Authored by: dbs on Fri, Apr 25 2008 at 8:23AM PDT
This same approach worked just fine with 10.5.0, except for the little caveat that it failed when time machine needed to prune (delete) old backups to fit in new ones. Have you tested it with this to make sure it doesn't decide to erase your whole backup as it did in the past?


[ Reply to This | # ]
But does it work?
Authored by: mkuron on Fri, Apr 25 2008 at 9:08AM PDT
I've been using something very similar for a couple months now (since the 10.5.2 release) and it works like a charm. Backing up, restoring files, thinning out old backups, ...

[ Reply to This | # ]
But does it work?
Authored by: kuranuk on Fri, Apr 25 2008 at 8:21PM PDT
Evidently, there has been a fix to that very issue.
Again, your mileage may vary as this isn't officially sanctioned:

Time Machine Update Fixes Sparse Bundle Handling

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: diamondsw on Fri, Apr 25 2008 at 8:40AM PDT
You can use this approach on local drives as well, if you want to set up quotas for your backups and such. I posted some info about this on my blog as well.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: ngb on Fri, Apr 25 2008 at 11:31AM PDT
There are some problems with the command as posted.
  • there is no -library option for hdiutil (according to the man page)
  • the default size in in blocks, but can be specified in gigabytes using "g"
  • the -fs option should be "HFS+J", not "Journaled HFS+"
  • the -volname option was left out, but should be "Backup of $MACHINENAME" (see the link in the second comment)
With these corrections, the command should read like this:

hdiutil create -size $SIZEg -fs HFS+J -type SPARSEBUNDLE -volname "Backup of $MACHINENAME" $MACHINENAME_$MACADDRESS.sparsebundle

[ Reply to This | # ]

10.5: Set up Time Machine on a NAS in three easy steps
Authored by: theilgaard on Fri, Apr 25 2008 at 11:59AM PDT

As from reading the man-page for hdiutil, I think, that -library SPUD, actually meant -layout SPUD (at least this option has a SPUD parameter).

So the full command will be:

hdiutil create -size $SIZEg -fs HFS+J -type SPARSEBUNDLE -layout SPUD -volname "Backup of $MACHINENAME" $MACHINENAME_$MACADDRESS.sparsebundle

[ Reply to This | # ]
Correction to the corrections
Authored by: paulio on Fri, Apr 25 2008 at 3:19PM PDT
This will give you info on the library option:

hdiutil create -help

No, it is not in the man page.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: lowbatteries on Fri, Apr 25 2008 at 12:39PM PDT
Along these lines, if you already have a networked time machine backup, you can find the disk image, open it with Disk Utility, and use "Resize Image". I just tried this after reading this hint and it works!

This really should be an option in Time Machine to make it easier for many computers to back up to a single Time Capsule or other drive without one person hogging all the space. In fact, I wonder how time machine handles if multiple users are backing up at the same time and the network drive runs out of space?

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: Dana Sutton on Fri, Apr 25 2008 at 3:10PM PDT
This is a great hint, but several points need to be made. 1.) You can skip all the bit about naming sparebundles. Just try creating one directly from Time Machine. Yes, it will fail, but it will be visible on your desktop for a couple of minutes, giving you plenty of time to make a note of the name it assigns to the sparsebundle. Let it disappear, then create one manually with the same name. 2.) You manually create a sparsebundle using Disk Utility. The Help file tells you how. As part of the creation process, you will be prompted to assign a size to the sparsebundle. It is vitally important that you select a size less than that of your NAS volume's physical capacity (and it is probably a good idea to leave an ample amount headroom so that Time Machine has space to do its thing). In the same way, if you are using your NAS as a central repository to back up multiple Macs, the total size of all the sparsebundles on your NAS should not exceed the capacity of your volume. 3.) I can't help wondering if these reports of Time Machine destroying data once it has to start removing files come from people who created sparsebundles larger than the capacities of their NAS volumes. Maybe so, maybe not. In any case, I'm not sweating this because my volume is big enough that it will be several years before I confront this problem, and I figure that by that time Time Machine will have undergone a lot of evolution, so that this problem will probably be ancient history. 4.) But just to be on the safe side, and because this hookup is not officially sanctioned by Apple, as an extra precaution I keep duplicates of my sparesebundles on a separate hard disk, I can bring them up as backups if I ever need to. Nevertheless, I've been using this setup for over a month and so far haven't had any trouble at all.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: deh2k on Sun, Apr 27 2008 at 5:10AM PDT
Does the Leopard install DVD recognize such a backup? In other words, is it possible to restore an entire disk from it?

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: jyu on Mon, Apr 28 2008 at 8:06AM PDT
This hint is awfully similar to the following which is posted on April 20th, 2008 at 10:38 pm.

http://www.readynas.com/?p=253

Plus, can anyone tell why the -library option is needed?

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: ybizeul on Wed, Apr 30 2008 at 8:39AM PDT
I do not understand the point of the command line stuffs...

  • I just took Disk Utility in Leopard, create a sparsebundle disk image from here, naming it according to the name of my machine and en0 MAC address.
    The thing is, like time machine, Disk Utility can't create the .sparsebundle on the remote volume directly, so create it on your desktop, and copy it manually in the finder.
  • In terminal : defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
  • If you get troubles in Console saying that this is not the correct time machine backup disk, try removing the file named .xxxxxxxxxxxx in the root of your share, and test again.
  • Concerned about security ? You can even crypt your DMG !!! Yes, create your sparsebundle with 128bit AES encryption, it works perfectly. The trick is to save key in your keychain, when mounting the DMG manually, then go to Keychain, and copy/paste the entry from your user keychain to the system keychain.

  • From now, no need to mount your smb share or anything, everything is automatic, and people having access to the share cannot see your precious private files.

    [ Reply to This | # ]
fail: "The backup disk image could not be mounted"
Authored by: anto1ne on Sat, May 3 2008 at 9:21PM PDT
the backup always failed with all the informations found in this hint and commentes, with message :
"The backup disk image could not be mounted"

and if I mount it, proving there is nothing wrong with the image, it says the same error, only after 'preparing' for a long time.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: dabl on Wed, May 7 2008 at 12:29PM PDT
>Does the Leopard install DVD recognize such a backup? In other words, is it possible to restore an entire disk from it?

Right, I notice none of the articles address restoring a full image to the original partition.

Can one boot from the OS X install DVD to locate a bootable complete OS X image located on a network drive and restore it to the local disks' original partition?

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: toominator on Mon, May 12 2008 at 8:02AM PDT
Ive tried all the listed tips, and after copying the sparsebundle to my AFP share, TimeMachine is still unable to see any volumes.

I've used

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

but still nothing appears in the TimeMachine select volumes box.

*sigh*


[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: bluehz on Sun, May 25 2008 at 10:08PM PDT
Everything seems to work when I set this up, but the backup never completes indicating it needs more room, I made the SPARSBUNDLE disc image 1G to start and in my test attempting to backup 150mb fails, sez the disc only has 89mb available. I was under the assumption the sparbundles were self-expanding as needed.

Am I doing something wrong?

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: MJL on Fri, Jul 4 2008 at 3:11PM PDT
After about three days of playing with the sparsebundle and time machine, I finally got it to work. The key for me was changing the computer name in the System Preferences - Sharing to a name that did not include spaces, symbols, etc. (just numbers and letters) and keeping the name of under 8 characters

Before this, I kept getting an "The backup disk image could not be mounted"
error.

Also, I've read that you should remove the backup from Spotlight. It helps makes things go much faster. Not sure if this is the case or not, but I did it. Go to System Preferences - Spotlight, then under the "privacy" tab, click on the Plus sign and add the backup under devices. It's not critical (at least not for me), but it may help.

I'm still in the process of backing up, so far 13GB out of 27GB are backed up. I'm keeping my fingers crossed until its done, but at least, I'm not geting the can't mount error any more.

Good luck.

My setup - MacBook backing up to a HP Media Smart Server over a wireless g network.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: MJL on Tue, Jul 15 2008 at 8:21PM PDT
So, the computer ran for about three hours and then a black screen popped up that forced me to restart the computer.

Well, it sounds like a great idea, but I haven't gotten it to work. We ended up using an old USB hard drive to backup the computer.

I might try it again at some point, but I've been looking at some third party backup programs. They seem to offer backup to a networked drive, so I might try that. However, I would really prefer to use TM, but this is too frustrating. Maybe I'm doing something wrong. Hopefully, someone will figure it out.... if you do, please let us know.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: Analog on Wed, Aug 20 2008 at 7:12PM PDT
My laptop drive failed a few weeks after I added the ability to use Time Machine over the network via this tip. While I was able to retrieve the data, I'm glad I was using it as a secondary backup when trying to figure out how to restore from a network backup.

As a result of my experience I do not recommend using Time Machine over the network unless you're positive you have the means and ability to restore your data.


Notes:
If you boot from the installer, open terminal, use the write defaults command, the TM volume will NOT show up. If there is in fact a way to have it show up while booted up off the DVD (and after having run the "write defaults" command,) I'd love to see it!

For future reference here is the path I took to restore from a network TM backup, iirc:
- installed 10.5 on an external drive, booted off that and copied the sparsebundle over, since my server doesn't support sparsebundles (yeah I could have mounted it over the network but I wanted things to be local)
- mounted the sparsebundle and cloned that to a second external drive.
- While waiting for my internal drive to be replaced, I installed a spare 2.5" internal sata drive. I'm mentioning this because I booted off the install dvd, used the Time Machine data from the second external drive to restore all my data to the internal. Then when I got the replacement drive I just swapped the drives and did a straight clone.

YES the path I took could have been more efficient, such as making use of target disk mode and partitions. For my hardware situation it worked well. I am simply trying to make the point that until Apple officially supports this, don't rely on it as a single backup solution. Just pony up for a normal hard drive or use another method. my .02.


[ Reply to This | # ]
Updated guide for 10.5.5, works when your computer name has spaces
Authored by: adamcr on Thu, Oct 23 2008 at 10:00AM PDT

I've updated my guide to getting Time Machine working on non-Apple network drives (including over a wireless network).

I've also included a modified version of these instructions with a small correction to make the hdiutil call work on 10.5.5 and another that deals with Computer Names that have spaces and apostrophes.

Everything's working fine for me -- but watch out for putting your computer to sleep during a Time Machine backup!

Thanks for the article and the link!

Adam



[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: gerg on Mon, Nov 10 2008 at 6:40PM PST
anto1ne wrote:
backup always failed with all the informations found in this hint and commentes, with message : "The backup disk image could not be mounted"
I was having the same problem on my newly-installed 10.5 Macbook Pro. Some hints at another site pointed me to opening the Console utility and using it to watch the system.log. The errors I saw said the backupd program was trying to unmount and re-mount the share. I can't post the exact lines from the log file, but they said three things each time my backups failed:

   Network mountpoint /Volumes/backup not owned by backupd... remounting
   Failed to remount network volume.
   Backup failed with error 19.
I realized that I had the share open in Finder, so it was mounted. I ejected the share in Finder so it would be unmounted, and tried Time Machine again. Bingo. My Time Machine backups started working! Maybe this will help some other folks... Greg

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: lookfirst on Fri, Nov 14 2008 at 9:05AM PST
If you have a Drobo/DroboShare NAS, I've spent a lot of time creating a FREE solution for it that installs pre-configured netatalk (AFP) and avahi (Bonjour) packages on the DroboShare. It makes your Drobo available for TimeMachine backups.

I've also created an Automator action application which does the 'defaults write' and creates the initial sparsebundle for you. This is a reliable painless way to do backups that gets you a far better deal than a TimeCapsule. It has even been tested with a full system restore without any problems.

Tell your friends!

Downloads and Documentation: http://code.google.com/p/backmyfruitup/

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: jg167 on Sun, Mar 8 2009 at 1:30AM PST
I think the hdiutil command shown is wrong. At least in 10.5.6 I used
the info from http://appleclinic.wordpress.com/2008/10/30/time-machine-on-nas/

showing
sudo hdiutil create -size $GIGg -type SPARSEBUNDLE -nospotlight -volname "Backup of My Mac" -fs "Case-sensitive Journaled HFS+" -verbose ./$Computername_MACaddress

this (plus the default write unsupportedNetwork drive thing) worked, TM sees the "drive".

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: hydro on Mon, Jul 20 2009 at 5:53PM PDT
Although this article was posted some time ago, and here it is July 2009, I have a question specifically about step 3:

> Copy the sparsebundle to the network share root. Easy enough.
> Mount your network share and copy it over. I used this Terminal
> command after the MyBackup share was mounted:
> cp -r mymachine_0017f2c8426b.sparsebundle /Volumes/MyBackup/.

Given that sparse bundle disc images are actually parent folders (containing files and subfolders) that reside on the file system, as far as I'm aware, the file system to hold a sparse bundle disc image must be HFS+ so does it matter therefore does not the "network share root" also have to be HFS+ or is it possible for it to be another file system such as NTFS, FAT32 or ext3, etc.?


[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: Sesquipedalian on Tue, Jul 21 2009 at 11:55AM PDT
The host file system does not have to be HFS+. However, the sparse bundle will appear as a folder with a ._* file next to it, where * is the name of the sparse bundle. This is the mechanism used to store Mac metadata on non-native file systems. It would probably not be a good idea to delete or move the ._* file.

When mounted, the file system contained within the sparse bundle will be HFS+.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: gallen1119 on Wed, Nov 25 2009 at 9:54PM PST
Now it's November and I know the thread is old, but has anyone gotten this to work well in 10.6? I have searched and tried the recommendations but can't seem to get it.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: smides on Sat, Nov 28 2009 at 1:40PM PST
I just got this working this morning. One mistake I made was including the trailing "/" when copying the sparsebundle to the mount. I used autocomplete (tab) in the Terminal which automatically appends the "/". I used

  cp -r smides_[macaddr].sparsebundle /Volumes/[mount]

and then everything seemed to work. I'm doing my first full backup now. I'm curious if, since I'm using SMB, if the drive will mount correctly automatically the next time Time Machine wants to do a backup. We'll see.....

[ Reply to This | # ]

10.5: Set up Time Machine on a NAS in three easy steps
Authored by: lundman on Wed, Dec 30 2009 at 2:14AM PST
Probably worth mentioning that the reason it fails to create the sparsebundle on NFS (or other network mounts)
hdiutil: create failed - Inappropriate ioctl for device

which it is taking as fatal. Can probably find out which ioctl it is trying to use with dtrace, but won't fix it.

It is also worth mentioning that if you create the sparsebundle on local disk, then use "cp -r", you are copying sparse files as non-sparse. So suddenly you will actually take up the space. you can use "rsync -arv --sparse sparsebundle /Volumes/NFSDrive/" to copy it sparsely.

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: GaelicWizard on Sun, Jan 10 2010 at 9:13PM PST
I think that you're confused about what "sparse" means. I suspect that you believe that the files which together compose the "sparsebundle" disk image are in-themselves "sparse files", which is not true. HFS+ does not implement sparse files. The _disk image_ is sparse in the sense that the file system _within_ the disk image is larger than the disk image itself, that is: the file system inside the disk image is stored within the disk image in a sparse way, such that parts of the file system which are not useful are not stored in the disk image on the _physical_ disk.

JP

[ Reply to This | # ]
10.5: Set up Time Machine on a NAS in three easy steps
Authored by: doublelibra on Tue, Jan 26 2010 at 12:23PM PST
I have a theoretical question about all this. I have a NAS setup, and I just installed a 2nd drive there specifically for backups. I have 2 macs, a MBP & an iMac. I followed instructions for creating a sparsebundle disk image on the NAS drive for each machine to get time machine to work over the network, and got it to work. Since the drive is 1TB, I made 2 images at 450GB each, even though the 2 machines only currently need about 90GB & 150GB.

Now, based on advice elsewhere, I set up Superduper to back up to the same drive. This uses a similar process of creating a sparse image on that drive. Note that I say sparse image, not sparsebundle - I tried using the existing sparsebundles already created, but superduper didn't seem to want to do that, and in fact although sparsebundle is a choice in their menu, only sparse image would work. So I went ahead and did this but only with my MBP. It indeed created a separate sparse image, and it takes up the full amount of space necessary to back up the entire drive (90GB).

What I'm wondering is if I'm running the risk of quickly running out of room on my NAS drive, since I think TM will fairly quickly eat up as much space as you give it (450GB X 2 = 900 GB), and the superduper backup is taking up the full amount of hard drive space needed (90GB) to make a full backup (based on what I had read, I thought that somehow using superduper onto the same drive as your TM backups would mean superduper would 'piggy back' on TM's backed up files and only add the components needed to create a startup disk, and therefore not take up much space.) I was still hoping to also back up the iMac (120GB) with Superduper onto the same drive.

Thanks for any insight you may have!

[ Reply to This | # ]