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