Apple Time Machine on Server running Gentoo Linux

This guide is about how to add Apple Time Machine to a Server running Gentoo Linux. Since Apple's backup tool only supports thier own filesystem HFS+, we start with installing it and preparing the disk to be able to create the Time Capsule on it later.

emerge -avq diskdev_cmds
mkfs.hfsplus -v Backup /dev/md2    
mkdir /mnt/disks/backup
# optional: adding a mount point to your fstab
echo "/dev/md2      /mnt/disks/backup   hfsplus noatime     0 1" >> /etc/fstab

Futher we need to install two services - netatalk and avahi-daemon. Netatalk provides Apple's network filesystem protokoll, which is needed since using Time Machine over network requires afs. The Avahi Daemon is used to make Netatalk available in the network.

#  !!! NOTE make sure your use flags contains avahi
echo "net-fs/netatalk avahi pgp samba ssl utils" >> /etc/portage/package.use
echo "net-fs/netatalk ~amd64" >> /etc/portage/package.keywords
emerge -avq netatalk
# optional add both service to the autostart
rc-update add avahi-daemon default
rc-update add netatalk default

The next step is to configure netatalk that OS X could access the network drive by editing /etc/afs.conf as follows. Make sure the user(s) specified under valid user exists on the server. If not, create it. A client will need it to access the afs network drive.

; Global server settings
; uam list =,,
uam list =,
save password = no

file perm = 0664
directory perm = 0774
cnid scheme = dbd
valid users = phgamper

; [Homes]
; basedir regex = /xxxx

; TMAFPVoume could be replaced by a name of your choice
time machine = yes
path = /mnt/disks/backup/timecapsule
vol size limit = 1000000

Once we finished, we create the Time Capsule for the specified user(s). As mentioned above a client has to authenticate when connecting to the network file system. Thus the user has to own or at least has read, wirte and execution rights to the folder, where the capsule will finally be stored.

mkdir /mnt/disks/backup/timecapsule
chown phgamper /mnt/disks/backup/timecapsule

Finally we are finish with configuring the server and could go on starting netatalk and avahi-daemon.

/etc/init.d/avahi-daemon start
/etc/init.d/netatalk start

Now the server is ready and should appear in the Time Machine's system configuration. If not, the following fix on your client should work.

defaults write TMShowUnsupportedNetworkVolumes 1

Further Reading