FreeBSD and OS X Lion Time machine

apple_time_machine

Time machine for Mac OSX was introduced in Leopard 10.5.0 and it is certainly a very nice feature for maintaining backups of your MAC. But until today you had to use an external disk or Apple’s Time Capsule in order for this to work. There have been some workarounds for using a NAS over CIFS or Samba but those where not officially supported by Apple.

In OS X Lion 10.7.0 there is finally the option to use TimeMachine over your network as long as your storage supports AFP the Apple Filing Protocol.  Apple still recommends that you run OS X Lion server but as we will see it works pretty well with FreeBSD so now you can use your NAS to keep those backups, or even create a central repository for all the clients.

  • First you have to install the AFP protocol provided by NetATalk.

Important!!! Make sure that you only select APPLETALK and remove ZEROCONF from the options!

cd /usr/ports/net/netatalk/ && make install clean
  • Next edit /usr/local/etc/AppleVolumes.default and adjust to your needs:
/tank/apple/ Time Machine allow:gkontos options:tm,usedots
  • Add the following to your rc.conf:
netatalk_enable="YES"
cnid_metad_enable="YES"
afpd_enable="YES"
  • Start the service
/usr/local/etc/rc.d/netatalk start

And you are ready to connect, afp://xxx.xxx.xxx.xxx

Now open your Time Machine preferences and select your new volume as the backup volume. You should be able to run Time machine and backup your files.  Some extra configuration is needed in order to be able to perform a full restore with the boot DVD.

  • Install Apple’s mDNSResponder:
cd /usr/ports/net/mDNSResponder && make install clean
  • Create the file /usr/local/etc/rc.d/mdnsadv with the following content:
#!/bin/sh

# PROVIDE: mdnsadv
# REQUIRE: LOGIN mdnsd
#
# Add the following lines to /etc/rc.conf to enable the mDNSResponder service advertising:
#
# mdnsadv_enable="YES"

. /etc/rc.subr

name="mdnsadv"
rcvar=${name}_enable

command="/usr/local/bin/mDNSResponderPosix"

load_rc_config $name

: ${mdnsadv_enable="NO"}

command_args="-f /usr/local/etc/mdnsadv.conf >/dev/null 2>&1 &"

run_rc_command "$1"
  • Don’t forget to make the file executable by issuing:
chmod ugo+x /usr/local/etc/rc.d/mdnsadv
  • Create the advertising configuration file /usr/local/etc/mdnsadv.conf with the following contents:
AFP Server
_afpovertcp._tcp
548
title='File Server'

TM Volume
_adisk._tcp
9
sys=waMA=XX:XX:XX:XX:XX:XX,adVF=0x100
dk0=adVF=0x83,adVN=Backup

XX:XX:XX:XX:XX:XX is your storage mac address.

  • Add to /etc/rc.conf the following line:
mdnsadv_enable="YES"

Now start mdnsadv service and you will be able to do a full restore from Apple’s boot DVD.

UPDATE May 2012

If you are using netatalk 2.2.3 then you need to adjust afp.conf at the end:

- -tcp -noddp -uamlist uams_dhx_passwd.so,uams_dhx2_passwd.so

 

Powered by BareBSD
 

6 Responses

  1. N. Miller says:

    This is the first “official” support of TM to AFP volumes, but it’s been possible for a long time. I’ve run my TM backups to AFP running on Solaris 10 (w/ZFS) since I started using Snow Leopard; prior to that I used Linux & Leopard. You just have to manually create the sparsebundle on a local disk, transfer that to the AFP share, and use the command “defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1″ to enable it on the Mac. It’s been very reliable, even over wireless. AFP has always been faster than SMB and NFS–until Lion–looks like they’ve worked on serious NFS improvements.

  2. Pingback: On building a FreeBSD based NAS for Apple TimeMachine, part 5 | arihuttunen

Leave a Reply

*


*