Using FreeBSD as a Time Capsule for OSX

Mon 19 December 2016 by feld

I've had both a coworker and a FreeBSD developer ask me recently how to use FreeBSD as a Time Capsule for Time Machine from OSX. There are a lot of tutorials out there and most of them are non-functional. This is possibly the simplest guide that is known to be working. It uses local unix account authentication for the shares over AFP, and of course it's backed by ZFS.

pkg install netatalk3 avahi-app

/usr/local/etc/afp.conf:

[Global]
vol preset = default_for_all_vol
log file = /var/log/netatalk.log
hosts allow = 172.16.1.0/24 2001:470:1f11:1e8::/64
mimic model = TimeCapsule6,116

[default_for_all_vol]
#file perm = 0640
#directory perm = 0750
cnid scheme = dbd
#ea = none|auto|sys
ea = ad

[backup-mark]
path = /local/timecapsule/mark
valid users = feld
time machine = yes

/usr/local/etc/avahi/services/afp.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-group>

/etc/rc.conf:

# time machine
dbus_enable="YES"
netatalk_enable="YES"
afpd_enable="YES"
cnid_metad_enable="YES"
avahi_daemon_enable="YES"

I'm aware Apple is moving away from AFP to SMB, but I haven't investigated what it would take to make this work with Samba instead of Netatalk.