Use Ubuntu network share for Apple TimeMachine backups?
I want to backup my Mac to a network drive mounted on my Ubuntu computer. How do I set this up?
NOTE: this is now out of date. See linked question re: TimeMachine in High Sierra
This is actually really straightforward. My solution below works for a single user, but can likely be easily adapted for multiple users.
On the Ubuntu machine:
Make sure the directory to be shared is mounted and owned by your user (e.g., your backup hard drive is mounted at
/mnt/backups
in/etc/fstab
, and you've created a subdirectory calledmyMac
in this backup folder). Because this is a network share it actually doesn't matter what format the disk uses - it could be ext4, btrfs, etc.-
Install
netatalk
(open source AFP):sudo apt-get install netatalk
-
Configure the Apple share by editing location at the bottom of the
/etc/netatalk/AppleVolumes.default
file (comment out the line with the home directory and add the actual mount location; add your username):#~/ "Home Directory" /mnt/backups/myMac "TimeMachine" allow:username options:tm,usedots,upriv
(I'm not sure that
options:usedots,upriv
needs to be explicitly set but it works for me.) -
Restart the
netatalk
service:sudo service netatalk restart
Make sure ports 548/tcp and 5353/udp are open in your firewall.
On the Mac machine:
-
Open the terminal and enter:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Reboot the computer.
-
Mount the network share location by selecting the network share from the leftmost pane in a Finder window, or by selecting "Connect to server" from the Finder app's "Go" menu (or press
⌘
+K
) and enter the machine name or IP address of your Ubuntu machine:afp://123.456.789.123
Use your Ubuntu user credentials to authenticate when prompted.
-
Go to Time Machine preferences (accessible from "System preferences") and select "Change location", selecting to encrypt backups, and begin the backup setup process.
- This will automatically create the sparsebundle file necessary for backups.
After setup is complete, wait ~90 seconds for backup to automatically begin, and even longer for it to complete ☺