Once I had managed to get Leopard up and going on the mac mini with all of the user settings copied over, it was time to start exploring new features. Time Machine was first on the list – but I wanted to have it back up over the network to my Ubuntu Linux server. I probably took the long route to a solution, but what I have seems to be working. The two main parts of getting time machine to work are: a) make it so the Mac can see the network storage b) trick time machine into using it as a destination.
Part A – I believe that you can use a non-AFP network storage solution (and my Mac can see my Samba volumes for shared files) but I went the route of enabling AFP. This is based on instructions found here, but I’ll repeat it here with my comments:
- We’ve got to recompile netatalk to have encryption. You’ll need the universe repository enabled, and the development tools. Details can be found in the ubuntu forums.
sudo apt-get install dpkg-dev
sudo apt-get install devscripts
sudo apt-get install libssl-dev
apt-get source netatalk
sudo apt-get build-dep netatalk
sudo apt-get install cracklib2-dev
sudo dpkg -i ../netatalk_2.0.3-3ubuntu1_i386.deb
You’ll probably want to issue a ‘hold’ on the netatalk package by using dpkg –set-selections to prevent being upgraded
For the lazy – here is a link to the .deb I created.
- Modify the configuration file /etc/netatalk/AppleVolumes.default to point at the location you are going to store files. Ensure ownership and permissions are correct for the user you want to have access this location.
- Now we install avahi
sudo aptitude install avahi-daemon
Edit /etc/netatalk/afpd.conf to contain:
- -noddp -uamlist uams_randnum.so,uams_dhx.so
you might add -noslp to that line above to remove a warning, the key is that the configuration must be on a single line.
Edit the hosts line in /etc/nsswitch to match
hosts: files dns mdns4
Download using wget http://www.disgruntled-dutch.com/media/afpd.service
and install that in /etc/avahi/services
Restart the services:
sudo /etc/init.d/netatalk restart
sudo /etc/init.d/avahi-daemon restart
At this point your Mac should be able to discover the service and see the volume as a shared drive.
Part B – Tricking the Mac into using this volume as a backup. You may not need to do any of the work in Part A at all as is evidenced by other people claiming success on the net.
- Create a file named “.com.apple.timemachine.supported” at the root of the filesystem we pointed at in (2). I’m not entirely sure this is required, but it didn’t hurt.
- On the Mac we need to fiddle one default. Enter the following command in a terminal:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
At this point, Time Machine would connect, but then fail with the error message: “Time Machine Error – Backup disk image could not be created”
- The ReadyNAS folk had a solution that worked for me. Create the backup volume locally on the Mac and move it to the network volume:
Determine your hostname, hopefully it is a simple one.
Issue the command “ifconfig en0 | grep ether” which will find the MAC address of your Mac.
Using <hostname>_<mac address>.sparsebundle as the filename we create a new volume:
hdiutil create -size 140g -fs HFS+J \
-volname "Backup of magpie" \
Copy the newly created “sparse bundle” to the network volume.
- Now start up Time Machine – you should be good to go. I opted to leave SpotLight enabled, this did significantly slow down the backup performance – but I do want the ability to search for “lost” files from the backup.
Time Machine is pretty weird. I had assumed (wrongly) that it simply gave you a file view in time. It turns out that many of the Mac applications are time machine aware, and will show you a views of the past. For example, you can view your email through time and recover the mailbox from the past.
[Edit: April 2013 – it’s been some time since I stopped using this solution. I experienced this failing twice for me in basically the same manner. When the timemachine volume would get full my backup would stop being accessible. Instead of spend more time figuring out what exactly was wrong, I’ve moved onto an rsync (rsnapshot) based solution].