How to use your NAS with Time Machine

Questions about using NAS on Mac OS.
Post Reply
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

How to use your NAS with Time Machine

Post by stevebow »

OS X 10.5 "Leopard" introduced Time Machine, a very useful backup system that allows you to visually page-through previous backups. By design, it will only work with locally attached volumes or Apple's Time Capsule. However, there's a trick to make it work with your NAS...

The steps to enable Time Machine to allow use of your NAS as a backup volume requires a bit of fiddling, namely use of the Terminal to enter commands. I will assume you at least know how to start the Terminal and use it basically. I will guide through using a QNAP TS-409 Pro, but the steps will be similar for other NASes. I have used OS X 10.5 in the following procedure, other OS X versions may differ slightly. I am also accessing my NAS shares via Samba (smb) and not AFS or NFS. The following may apply for these protocols, or they may not. If someone could confirm, that would be nice. :)

Before you carry out the following, please disable any Anti-Virus software you may have installed. This is because AV software (eg. Norton) will scan a file we will create while it is being created and lock it while doing so, causing an "error 49168" to occur. Re-enable the AV software when you are finished.

Another reported problem has been with Little Snitch, which was preventing Time Machine from accessing the network backup volume. The person who reported the issue uninstalled Little Snitch and after a reboot all worked fine. I don't use Little Snitch myself, and if anyone knows if it can work with Time Machine over a network, please post a comment. :)

1) The first thing you will need to do is to find out your Mac's Computer Name and its ethernet MAC (not to be confused with "Mac"intosh). The ethernet MAC is an identifier that is unique for your ethernet port on your computer in the whole world, similar to a serial number if you will. Presumably Time Machine uses this to ensure the archive it will backup to is the correct one for that Mac.

As we will be using the Terminal throughout, we'll use it to find this information, although it can also be found in the System Preferences.

In the Terminal, enter:

Code: Select all

scutil --get ComputerName
and

Code: Select all

ifconfig en0 | grep ether
Note: even if your Mac is connected to your router via Airport/WiFi, it is still the MAC of the built-in ethernet port that is needed, even if the ethernet port itself is not used.

2) You will need to create a disk image that will actually store the backup data (archive) and we'll create what is known as a "Sparse Bundle". A Sparse Bundle is a Disk Image type that has the advantage over the other two Disk Image types (UDIF, Sparse) in that it is faster, but the big advantage (which the Sparse type also has) over UDIF is that when created, the initial size is just a fraction of the full size ie. it grows as it is used until full. The Sparse Bundle will have to be created on a local volume and later moved to your NAS. If you try to create it directly on the NAS, the process fails with an error. This may be a bug or perhaps Apple have done this deliberately, who knows.

The command that will be used in the Terminal will look something like this:

hdiutil create -size XXXg -fs HFS+J -volname SomeName ComputerName_Macaddress.sparsebundle

The "SomeName" will be a label displayed in the Finder for the Sparse Bundle whenever it is mounted. I have used "TS-409_TM_Backup".

Let's create a Sparse Bundle with a maximum "growth" size of 250GB (this can be any size you wish). So if your Computer Name from Step 1 is MyMac and your ethernet MAC is 00:1b:63:a6:7a:4d, you would enter:

Code: Select all

hdiutil create -size 250g -fs HFS+J -volname TS-409_TM_Backup MyMac_001b63a67a4d.sparsebundle
This should be created in a few seconds in your Home folder and be around 115MB in size. Note: a Sparse Bundle will increase in size until the specified maximum as it fills, but will not shrink as data is removed. You can change the maximum size at a later date using Disk Utility, although I have not tried this myself.

If you receive a "hdiutil: create failed - error 49168" message at this point, is your Anti-Virus software disabled?

3) On your NAS, create a new share just for Time Machine, to keep things tidy.

On the TS-409, this is done in Administration->Network Share Management->Create. Enter a share name of TimeMachine. You may wish to enter a comment, along the lines of "Mac Time Machine backup location on TS-409". Leave everything else as it is. On the next page, add the "administrators" group to the Access Rights list (left side) with "Full access" Permission. Check that both the "administrators" and "everyone" groups have "Full access" permission to the "TimeMachine" share.

Confirm this new share appears in the Mac Finder along with the other shares on your NAS.

Move (ie. copy, then delete original) the Sparse Bundle you created in Step 2 to this new share.

4) You will need to allow Time Machine to display network volumes in its Change Disk dialog, as by default only locally attached volumes are listed. This is accomplished by entering the following in the Terminal:

Code: Select all

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
5) Open the Time Machine preferences and click Change Disk... The new share you created in Step 3 (TimeMachine) should appear, but only after you have copied the Sparse Bundle file to it first. Select this volume and you're good to go.

6) Enter any exclusions in the Options... dialog and Time Machine should already be preparing to do the first backup. The first back up will take much, much longer than subsequent backups.


There are a few caveats to using a NAS as a Time Machine volume.

1) While Time Machine does automatically mount the NAS share TimeMachine and automatically dismount it when a backup has completed, accessing the archive (Enter Time Machine) will not dismount the volume when you leave it. This is no big problem, it's up to you to eject it when you are done if you wish.

2) ***IMPORTANT*** You will need to disable "Fast User Switching", because with it enabled Time Machine will fail on occasion.

What happens is that a single NAS share is mounted multiple times, once for each individual user that is logged in that accesses that share. For the Time Machine share, it will be mounted with the original label "TimeMachine" for the first user, then "TimeMachine-1" for the second user, "TimeMachine-2" for the third user, and so on.

Because Time Machine has been configured to use the volume "TimeMachine", if the second user is logged in by Fast User Switching and Time Machine attempts to do its backup, it will fail if the TimeMachine share was already mounted by the first user (perhaps they were browsing the Time Machine archive), because it won't have permission to access the "TimeMachine" volume mounted already by that first user. Going back to the first user and ejecting the TimeMachine share does not seem to fix it either. Once mounted as TimeMachine-1 for a particular user, it seems to remain stuck that way. Rebooting does tend to fix that!

Annoyingly enough, each user sees only the original "TimeMachine" label on their desktop, without the "-1", "-2", etc. suffix. You would have to go to /Volumes to see the full filenames. I have no idea why this is so, ask Apple.

In fact, the same could be said for networked shares generally, I have found. Any programs that reference directories/folders or shortcuts/aliases will fail when accessed while logged in as the non-first user, because of this "-1" etc. naming convention. It appears each individual mount has the Samba user password associated with it.

I have lost a lot of hair over this issue and in the end just disabled Fast User Switching. My life has returned to some sense of normality since.

Fast User Switching is disabled in OS X by default, but if you've enabled it and forgotten how to disable it, here's what you do:

1) Open the Accounts Preferences Pane
2) Click on the lock to make changes
3) Go to the Login Options tab and uncheck the "Enable fast user switching" option

As mentioned at the beginning of this tutorial, my experiences have only been with Samba/smb. Using AFS and NFS may yield different results. If there are any problems after following this tutorial, try rebooting your Mac and NAS.

Any feedback welcome, and much peace of mind with your NASed Time Machine!
Last edited by stevebow on Fri Oct 24, 2008 9:13 pm, edited 6 times in total.
JDH
Easy as a breeze
Posts: 477
Joined: Sun Dec 30, 2007 4:55 pm

Re: How to use your NAS with Time Machine

Post by JDH »

Thanks Stevebow for your detailed and easy to follow instructions. I set the TM without any hair lost. :P

BTW, could I delete the Sparse Bundle remained in the Mac that was created in step 2) please?
NAS Model: TS-453B Mini/TS-253P
FW Ver: 4.4.3.1421 / 4.4.3.1421
OS: Win10 (MS Edge)
No. of HDDs: 4/2
HDD Model: WD Red
HDD Capacity: 6/3TB
RAID Config: RAID 1
Services enabled: All standard services
Ext. Devices: USB Printer (HP Laser Jet 1320)
NAS Speed/MTU: 100Mbps/1500 Bytes
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

Re: How to use your NAS with Time Machine

Post by stevebow »

That's good to hear, thanks for the feedback (well, confirmation that it works for others too! :D )

Yes, you can delete the original Sparse Bundle. I've updated Step 3 to reflect this.
NAS: TS-509 Pro
Firmware: 4.1.1 Build1101
Drives: 5 x Western Digital WD20EFRX (Red) 2TB drives (RAID5)

NAS: TS-409 Pro
Firmware: 3.3.2 build 0918T
Drives: 4 x Western Digital WD20EFRX (Red) 2TB drives (RAID0)
Note: TS-409 Disk Management GUI mostly non-functional with WD Red HDDs
dustin
Starting out
Posts: 11
Joined: Wed Aug 13, 2008 8:12 pm

Re: How to use your NAS with Time Machine

Post by dustin »

Hi Stevebow,

I have followed your instructions but get and error with the hdiutil command:

beast:~ dfisher$ hdiutil create -size 250g -fs HFS+J -volname Timemachine beast_0016cba1a9af.sparsebundle
hdiutil: create failed - error 49168

Any ideas?

Thanks,
Dustin

Edit: Ok it seems to have fixed itself. I was trying to create a 250g sparsebundle and it would return that error. So i created a small one, 25g and it worked. Though i tried to resize it (hdiutil -resize), that too failed. So i deleted it and created a marginally larger one, 50g, that worked.

Eventually i managed to create a sparsebundle at 250g, after slowly increasing the size and deleting it. Go figure. Now time machine is backing as per Steve's instructions (thanks Steve).
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

Re: How to use your NAS with Time Machine

Post by stevebow »

dustin wrote:hdiutil: create failed - error 49168
Do you have Norton or some other AntiVirus software installed on your Mac?
NAS: TS-509 Pro
Firmware: 4.1.1 Build1101
Drives: 5 x Western Digital WD20EFRX (Red) 2TB drives (RAID5)

NAS: TS-409 Pro
Firmware: 3.3.2 build 0918T
Drives: 4 x Western Digital WD20EFRX (Red) 2TB drives (RAID0)
Note: TS-409 Disk Management GUI mostly non-functional with WD Red HDDs
whitjacket
New here
Posts: 2
Joined: Wed Sep 03, 2008 1:22 am

Re: How to use your NAS with Time Machine

Post by whitjacket »

hello guys

i´m from germany, please have understanding about my bad writing :oops:
i try to make timemachine with my qnap ts101 but it´s all time not working. i spend a lot of time with this problem and the timemachine dont want work.
I make the sparsebundle with my ethernet mac id not the airport id and with my computername.
i make a new share on the qnap and i copied in this folder. i write the neassary command in the terminal to found the networks under timemachine systempanel. And i starting the backup over airport.
the mac os leopart system tell he cant activate the share. this message comes after 10sec. all times :(
i dont understand this. i not found reasson. for anyone answer to help me........i say thanks
User avatar
crashray
Know my way around
Posts: 115
Joined: Tue May 13, 2008 12:06 am

Re: How to use your NAS with Time Machine

Post by crashray »

I will try this soon. Thanks for the step by step. Maybe some screen and a page on the wiki will be great :mrgreen:
Image iMac alu 24" - 2.8 Ghz - 4 Go RAM - 320Go DD - 500 Go Lacie USB TimeMachine
Image iPhone 3G 8 Go
QNAP TS-409 with 4 WD 1 To in RAID 5
jakob
New here
Posts: 4
Joined: Fri Jun 06, 2008 4:09 pm
Location: London

Re: How to use your NAS with Time Machine

Post by jakob »

This is an excellent guide - worked like a dream!

Jakob
Jakob

QNAP 209 Pro with [Apache/1.3.37 (Unix) PHP/5.2.0]
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

Re: How to use your NAS with Time Machine

Post by stevebow »

whitjacket wrote:i´m from germany, please have understanding about my bad writing :oops:
Gar kein Problem, wahrscheinlich viel besser als mein Deutsche! :wink:
i try to make timemachine with my qnap ts101 but it´s all time not working. i spend a lot of time with this problem and the timemachine dont want work.
I make the sparsebundle with my ethernet mac id not the airport id and with my computername.
i make a new share on the qnap and i copied in this folder. i write the neassary command in the terminal to found the networks under timemachine systempanel. And i starting the backup over airport.
the mac os leopart system tell he cant activate the share. this message comes after 10sec. all times :(
i dont understand this. i not found reasson. for anyone answer to help me........i say thanks
Exactly what is the message reported? Just write it as it appears in German, I'll understand it.

First question, have you disabled Fast User Switching?
Next, I'd like you to reboot your Mac (to be sure). When you've booted and logged in, open the Console (found in the /Applications/Utilities folder). Make sure it displays the list of logs on the left (you have to enable it by clicking on an icon) and make sure "All Messages" is selected in this list (at the top).
Now, manually force Time Machine to do a backup. Any errors will be logged in the Console. Please copy and paste these lines here so I can see what is happening.
NAS: TS-509 Pro
Firmware: 4.1.1 Build1101
Drives: 5 x Western Digital WD20EFRX (Red) 2TB drives (RAID5)

NAS: TS-409 Pro
Firmware: 3.3.2 build 0918T
Drives: 4 x Western Digital WD20EFRX (Red) 2TB drives (RAID0)
Note: TS-409 Disk Management GUI mostly non-functional with WD Red HDDs
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

Re: How to use your NAS with Time Machine

Post by stevebow »

crashray wrote:Maybe some screen and a page on the wiki will be great :mrgreen:
I've simply posted a link to the original article at the Wiki.

The instructions mainly involve typing commands in at the Terminal. What kind of screen grabs did you have in mind?

Let us know how it goes too!
jakob wrote:This is an excellent guide - worked like a dream!
Thanks for the feedback!
NAS: TS-509 Pro
Firmware: 4.1.1 Build1101
Drives: 5 x Western Digital WD20EFRX (Red) 2TB drives (RAID5)

NAS: TS-409 Pro
Firmware: 3.3.2 build 0918T
Drives: 4 x Western Digital WD20EFRX (Red) 2TB drives (RAID0)
Note: TS-409 Disk Management GUI mostly non-functional with WD Red HDDs
whitjacket
New here
Posts: 2
Joined: Wed Sep 03, 2008 1:22 am

Re: How to use your NAS with Time Machine

Post by whitjacket »

Guten Morgen Crystal Warrior

vielen Dank für deinen Tip mit der Console. Aufgrund dessen konnte ich die Ursache finden.
Schuld dafür das das Timemachine Backup nicht ausgeführt wurde, war Littlesnitch Version 1.2.2.
Nachdem ich L-Snitch deinstalliert habe und einen Neustart/Rechte rep. durchgeführt habe, funktioniert TimeMachine über das Netzwerk. :wink:
Vielen Dank nochmal

die Mac-Gemeinde bleibt einfach die beste :D
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

Re: How to use your NAS with Time Machine

Post by stevebow »

whitjacket wrote:vielen Dank für deinen Tip mit der Console. Aufgrund dessen konnte ich die Ursache finden.
Schuld dafür das das Timemachine Backup nicht ausgeführt wurde, war Littlesnitch Version 1.2.2.
Nachdem ich L-Snitch deinstalliert habe und einen Neustart/Rechte rep. durchgeführt habe, funktioniert TimeMachine über das Netzwerk.
Sehr Interessant. Ich werde meinen Tutorium mit die Little Snitch Info aktualisieren, danke.
die Mac-Gemeinde bleibt einfach die beste :D
Natürlich! :D
NAS: TS-509 Pro
Firmware: 4.1.1 Build1101
Drives: 5 x Western Digital WD20EFRX (Red) 2TB drives (RAID5)

NAS: TS-409 Pro
Firmware: 3.3.2 build 0918T
Drives: 4 x Western Digital WD20EFRX (Red) 2TB drives (RAID0)
Note: TS-409 Disk Management GUI mostly non-functional with WD Red HDDs
tobman
New here
Posts: 5
Joined: Wed Feb 27, 2008 8:38 pm

Re: How to use your NAS with Time Machine

Post by tobman »

Thanks so much!
This was exactly what I was looking for!!
keithtm
New here
Posts: 6
Joined: Thu Sep 25, 2008 10:43 pm

Re: How to use your NAS with Time Machine

Post by keithtm »

[EDIT: MacBook reboot fixed it!!]

Thanks for the guide.

Got a couple of problems getting this to work.

I've got as far as configuring Time Machine, but it's just not seeing any potential Backup Disks.

I can see the .sparse file in the Time Machine share I created on my shared drive in Finder. I have spaces in my computer name - could that be the problem? I put the destination filename in quotes when creating it, and the name looks ok.

Or is it something to do with mounting drives? I have no idea if i'm using afs or smb or whatever... I'm just accessing the drive in Finder by clicking on the icon under Shared.

I'll do some more reading now anyway.
User avatar
stevebow
Been there, done that
Posts: 626
Joined: Mon Apr 07, 2008 11:46 am

Re: How to use your NAS with Time Machine

Post by stevebow »

keithtm wrote:[EDIT: MacBook reboot fixed it!!]
Thanks for that, I've updated the turorial to suggest a reboot if there are any problems.
NAS: TS-509 Pro
Firmware: 4.1.1 Build1101
Drives: 5 x Western Digital WD20EFRX (Red) 2TB drives (RAID5)

NAS: TS-409 Pro
Firmware: 3.3.2 build 0918T
Drives: 4 x Western Digital WD20EFRX (Red) 2TB drives (RAID0)
Note: TS-409 Disk Management GUI mostly non-functional with WD Red HDDs
Post Reply

Return to “Mac OS”