Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 2.20 / 5
  You rated: 3 / 5 (15 votes cast)
 
[279,105 views]  

10.5: Set up Time Machine on a NAS in three easy steps | 33 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 whoever posted them. This site is not responsible for what they say.
But does it work?
Authored by: dbs on Apr 25, '08 08:23:22AM

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 Apr 25, '08 09:08:24AM

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 Apr 25, '08 08:21:31PM
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 Apr 25, '08 08:40:45AM
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 Apr 25, '08 11:31:03AM
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 Apr 25, '08 11:59:55AM

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 Apr 25, '08 03:19:18PM
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 Apr 25, '08 12:39:19PM

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 Apr 25, '08 03:10:21PM

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 Apr 27, '08 05:10:19AM

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 Apr 28, '08 08:06:41AM
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 Apr 30, '08 08:39:41AM
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 May 03, '08 09:21:33PM

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 May 07, '08 12:29:23PM

>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 May 12, '08 08:02:32AM

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 May 25, '08 10:08:30PM

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 Jul 04, '08 03:11:54PM

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 Jul 15, '08 08:21:05PM

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 Aug 20, '08 07:12:37PM

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 Oct 23, '08 10:00:24AM

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 Nov 10, '08 06:40:21PM
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 Nov 14, '08 09:05:38AM
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 Mar 08, '09 01:30:11AM
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 Jul 20, '09 05:53:17PM

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 Jul 21, '09 11:55:37AM

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 Nov 25, '09 09:54:32PM

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 Nov 28, '09 01:40:12PM
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 Dec 30, '09 02:14:08AM

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 Jan 10, '10 09:13:23PM

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 Jan 26, '10 12:23:20PM

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 | # ]
10.6: Set up Time Machine on a NAS
Authored by: Clarky_X on May 08, '10 06:16:29AM

Can people help me here please. I am a bit techy but not THAT techy. I have a Thecus YES box NAS (N2100). I think I have the drives formatted as EXT3 or something. I have 2x 320GB drives in a raid array so they are mirrored. I have 4 users on the NAS that correspond to the 4 users on my Macbook which is running snow leopard. I have a folder on the NAS called backups which I think only my user account has access to but once I have this working I can add everyone else's account to.

My macbook has a 160GB HDD which has about 35GB free. On the NAS of the 320GB I have 120GB free. So for starters, will TM create a 125GB image that won't fit on the NAS or will it be compressed, I assume it will be compressed otherwise I may as well just copy everything to the NAS.

Anyway, I started by reading this thread and also the thread at http://forums.mactalk.com.au/14/70801-time-machine-backup-nas.html but although I managed to run the command that allows TM so see the NAS as a valid drive, I got an error running the hdutil command and have no idea where to go now. See below.

My mac computer name is "Stephen’s MacBook" and when I ran TM after step 1 on the aussie forum a file was created called "Stephen’s MacBook.tmp.sparsebundle".
I used the mac address of my airport card as found from system preferences network info.

The hdutil commands I ran in terminal were
hdiutil create -library SPUD -size 120g -fs Journaled HFS+ -type SPARSEBUNDLE "backup macbook" Stephen’s MacBook_xxxxxxxxxxxx.sparsebundle (mac addr removed but I didn't put the : in)
hdiutil create -size 120g -type SPARSEBUNDLE -nospotlight -volname "nasTMBak" -fs HFS+J -verbose ~/Desktop/Stephen’s MacBook_xxxxxxxxxxxx.sparsebundle -imagekey sparse-band-size=131072

and the error I got was
hdiutil: create: Only one image can be created at a time.
hdiutil: create: returning 0
Usage: hdiutil create <sizespec> [options] <imagepath>
hdiutil create -help

I don't understand what the verbose bit is, I don't understand what volname I need to use and I don't understand what the 131072 bit is.

If someone can give me a succinct explanation of what I need to do to progress to get TM to backup my macbook wirelessly to my Thecus NAS then please post reply.

Thanks all.



[ Reply to This | # ]
10.6: Set up Time Machine on a NAS
Authored by: jcraigfletcher on May 19, '10 02:49:39AM

I found that with Snow Leopard the System UUID was necessary (on an SMB NAS). See this

http://www.insanelymac.com/forum/index.php?showtopic=184462

After I had the System UUID properly set Time Machine worked properly.



[ Reply to This | # ]
10.6: Set up Time Machine on a NAS
Authored by: Clarky_X on Aug 23, '10 12:28:38PM

How big does the sparse bundle image need to be?
My nas has 320gb drive but only 114 free and my mac has 160 gb drive but 130 used.
I am assuming time machine compresses the backup file?



[ Reply to This | # ]