Mac OS X TimeMachine Backups on a Linux Server

With Mac OS X 10.5 Apple introduced it’s first backup solution for the rest of us. Most other programs I’ve used were either too complicated, too unreliable or a combination of the two or just to plain expensive. TimeMachine aims to solve all of that.

In the past I’ve used anything from plain copies via the Finder to Retrospect, Archiware (a great tool if you have a few machines and a server), rsync etc. For my dad for example all of those were not quite what was needed. The problem with most of these solutions in our modern world are, when you use a Laptop, you are not always connected to the backup system and hence schedules fail to run. As soon as manual intervention is needed, backups usually don’t happen.

TimeMachines approach seems logical with the use of external disks. As I have a Linux server running in my home and my MacBook Pro is always connected to the network be it via AirPort or Ethernet it makes sense to use the server for backups.

After a bit of googling I found a post on http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-m… outlining
This is what I had to do:

Prerequisites: I run an Ubuntu based system in version 8.10. Most of these things should apply to other Linux machines as well though.

The ubuntu/debian netatalk package comes without ssl support that is needed for Mac OS X to work because OpenSSL is not compatible with the GPL. Hence you either need to compile your own package or download this one here:

Rolling your own involves downloading the source packages

# apt-get build-dep netatalk
# apt-get install cracklib2-dev fakeroot libssl-dev
# apt-get source netatalk
# cd /usr/src/netatalk-2*
#DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -rfakeroot

Install it with

# dpkg -i netatalk*.deb

In order to prevent Ubuntu from automatically upgrading you newly installed package you need to set it on hold:

# echo „netatalk hold“ | sudo dpkg –set-selections

All you need to do next is configure /etc/default/netatalk and turn off everything but AFPD_RUN=yes

edit /etc/netatalk/afpd.conf to have the last line read

– -transall -uamlist uams_randnum.so,uams_dhx.so -nosavepassword -advertise_ssh

and finally in /etc/netatalk/AppleVolumes.default you get to list the shares netatalk shall serve you. Edit the file according to your wishes. It could be something like this:

/srv/TimeMachine/sg/ „TimeMachine“ options:usedots,upriv allow:myusername

That way only the user „myusername“ can access the share which is probably what you want. Also the share is nicely advertised as „TimMachine“.

Next in line is a Bonjour/Zeroconf daemon that will advertise the netatalk services on the network. In this case Avahi is used for that purpose.

a simple

# apt-get install avahi-daemon
# apt-get install libnss-mdns

should be all that is needed.

edit the hosts line on /etc/nsswitch.conf to read

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns

Now we need to tell Avahi that it needs to broadcast the availability of AFP across the network so that the server will automatically show up on the MacBook Pro.

Open /etc/avahi/services/afpd.service

<?xml version=“1.0″ standalone=’no‘?><!–*-nxml-*–>
<!DOCTYPE service-group SYSTEM „avahi-service.dtd“>
<service-group>
<name replace-wildcards=“yes“>%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>

now restart avahi

at this point the share pops up under network on the Mac.

Last but not least TimeMachine needs to be configured to use that share as its storage pool. Nicely enough Apple hides all network volumes except the ones from Mac OS X Server and TimeCapsule in the TimeMachine control panel. Heck, not even an AirPort base station with an attached USB disk can be used. Sometimes I really don’t understand Apple…

To get the Mac to see the network volume as a TimeMachine storage pool open a terminal and write

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

TimeMachine should create a sparsebundle disk image for the files. That is a special disk image that only uses as much space as is really just needed and grows in size afterwards. On my box this wasn’t created automaically, but you can easily create one with the disk utility on the Mac and copy it over to the Linux box. The filename of the image must be computername_MACADDRESS-OF-ETH0-WITHOUT-COLONS.sparsebundle
computername ist not your actual computername as seen in the sharing panel of system preferences but always simply „computername“.
That should do.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.