TimeMachine backup to a Linux serverpublished: / last edited:
Automatically make a TimeMachine backup in the local network onto a Linux server.
This was tested on Ubuntu Server 20.04 LTS.
We first need to install netatalk and the avahi-daemon - with netatalk, we need at least version 3, so if you are not on Ubuntu (or on an older Ubuntu install), make sure you have at least version 3.
sudo apt install netatalk avahi-daemon
We then need to create a directory and a user who is allowed to access this directory (or you can use an already existing user and/or directry):
sudo useradd --no-create-home your-username sudo mkdir /srv/timemachine sudo chown your-username:your-usergroup /srv/timemachine
your-usergroup with the username of your choice, and
/srv/timemachine with the folder of your choice)
The config of netatalk is saved in /etc/netatalk/afp.conf - we update it as follows (again, replace
srv/timemache with the values of your choice;
your-hostname will be the server name that appears in the TimeMachine configuration of your Mac):
; ; Netatalk 3.x configuration file ; [Global] hostname = your-hostname [TimeMachine] path = /srv/timemachine time machine = yes valid users = your-username vol size limit = 700000
vol size limit is set in MB, so
700000 will be 700 GB. Use at least as much space as your Mac disk has. Double the space is recommended to keep a history of file changes.
We then need to enable and start the avahi and netatalk daemons:
sudo systemctl enable avahi-daemon sudo systemctl start avahi-daemon sudo systemctl enable netatalk sudo systemctl start netatalk
If you have a firewall active, you need to open port
427 and port
4700 and then restart netatalk - for example, with ufw use these commands:
sudo ufw allow 548 sudo ufw allow 427 sudo ufw allow 4700 sudo systemctl restart netatalk
You should then be able to see the backup volume in the TimeMachine configuration; to connect, use the username/password of the unix user you created above. The Mac will run a backup every hour, if you are in the same network as your server. The first backup will take a long time (like, a day or so, depending on the size of your hard drive).
(Thanks to Gerrit for the basis of these notes: Time Machine Backups auf einen Linux Server sichern)
Have a comment? Drop me an email!