Time Machine via network and automount

So, after changing my entire storagesetup at home to go through network, both to keep my desk simple but most important, to get rid of the humming from the external disk, I was facing one problem: Time Machine, how to network with it?
Well, now I’ve found out the complete and perfect solution for this problem.

This guide assumes that you have a running server, NAS or whatever with some shared storage running. Also, this guide assumes that the fileshare is an AFP fileshare. Although, using Samba instead should be quite simple.

I have my NAS with the name “filecontainer” and I have created a share /Backup which I would like to use for Time Machine and other backup. Also, I have created a user with access only to this share (more on why later), also my NAS has 3 TB available, and I would not want it to be full of Time Machine data, so I want to limit this to 300 GB. Furthermore, I don’t want spotlight to look at this data.

Follow these steps.
For the steps in my procedure, you need to use Terminal.app for all commands. If you have no experience whatsoever with the Terminal, do not do this.

First, we need to have the fileshare mounted automatically when we power on the computer, so Time Machine can find it when it needs to. Do this by:

sudo vi /etc/fstab

Within that file, you put this line, editing the text that I posted in bold:

nas_name:/Backup /Network/Backup url auto,url==afp://backupusername:backup_password@server_IP/Backup 0 0

So, now you should be able to run this:

sudo automount -cv

And then try to access it, by:

cd /Network/Backup

If you do not receive any error, then try:

touch testfile ; ls -la ; rm testfile

If that works you should get a list of files 🙂

Now, networking works. Let’s prepare  Time Machine for what we are about to do. In Terminal, use this command:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

After that, we need to have this enabled so you need to log out and log in again (reboot not necessary, although you can reboot to test your automount)

When your computer comes back to life, we need to create a “sparsebundle” in which Time Machine will store your backupdata. For this we need the MAC address of en0 interface, as this is what Time Machine will look for, to get it use:

ifconfig en0 | grep ether | sed s/://g | sed s/ether//

Now we’re ready to create the sparseimage, see this and read below for further info on editing the bold parts:

sudo hdiutil create -size 300g -type SPARSEBUNDLE -nospotlight -volname “Backup of My Mac” -fs “Case-sensitive Journaled HFS+” -verbose ./Computername_MACaddress

300g: This defines that the sparseimage can grow up to 300 gigabytes, meaning that this virtual disk will have this size (although, it will not allocate the diskspace immediately)
Backup of My Mac : Whatever you think sounds nice for a backup device.
Computername_MACaddress: This is important, for it to work. The sparseimage must be called your computers name, followed by underscore and then the MAC address we extracted just before.

Now this gives you some input, but in the end you should have a .sparseimage with your options. Move it to the Backup share on your storageserver.

To set up Time Machine, go to “System Preferences” and then “Time Machine”, choose your Backup share as the disk. It will initialize and create the first backup, this will take a while 🙂

Congratulations! I hope you found my guide useful!

This entry was posted in Random. Bookmark the permalink. Both comments and trackbacks are currently closed.