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
/etc/fstab, and you've created a subdirectory called
myMacin 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.
netatalk(open source AFP):
sudo apt-get install netatalk
Configure the Apple share by editing location at the bottom of the
/etc/netatalk/AppleVolumes.defaultfile (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,uprivneeds to be explicitly set but it works for me.)
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:
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 ☺