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 called myMac
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 ☺
You can use Cronopete. Cronopete is a backup utility for Linux, modeled after Apple's Time Machine. It aims to simplify the creation of periodic backups.Launchpad.
To install, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-add-repository ppa:rastersoft-gmail/cronopetedev
sudo apt-get update
sudo apt-get install cronopete
To install from source, see Here
Or you can try Back In Time. Back In Time is a simple backup tool for Linux inspired from FlyBack and "TimeVault".Back In Time / Launchpad.
To install just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-add-repository ppa:bit-team/stable
sudo apt-get update
sudo apt-get install backintime-qt4
On a personal note, I use Systemback for all my backups, archiving, and imaging. To install it, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo add-apt-repository -y ppa:nemh/systemback
sudo apt-get update
sudo apt-get install systemback
Best Answer
[Updated answer]
This is a popular misconception - you can back up an APFS volume to a Time Machine using AFP via Netatalk. Confusion stems from ambiguous wording on https://support.apple.com/en-gb/HT208018 :
This caught out a number of people (including me). The HT208018 support article is trying to say: you can't do fileserving of files from an APFS volume to other Macs using AFP and further, you can't use a Mac APFS volume as the destination for a Time Machine backup (see https://apple.stackexchange.com/a/299720 for a detailed explanation).
Having said all the above, you can also use Time Machine with an SMB server (such as Samba) if the SMB server advertises the correct options (see below). At the time of writing (1 Oct 2017) you're in for a mildly rocky ride when trying to use Samba because you have to do a custom compile of Samba in the near-term (it will likely be next year that an appropriate pre-built Samba turns up by default in the periodic release Linux distributions).
[Update 2]
The patches have gone in and will likely be part of the Samba 4.8 release (currently that future release is too new to have a date on https://wiki.samba.org/index.php/Samba_Release_Planning ).
[Update 3]
The changes are now part of Samba 4.8 and above.
[Original text below]
The short of it is keep an eye on https://github.com/samba-team/samba/pull/64 and the mailing list thread related to it over on https://lists.samba.org/archive/samba-technical/2017-September/thread.html#122882 because something like it will have to go in for Time Machine to work with Samba without extra manual configuration on the Mac.
It's unclear how much Apple care about Samba these days (which started occurring when they stopped shipping it with MacOS after the Samba project switched to be GPLv3) so I'm afraid delays are to be expected. Let's see how it goes - kevinanderson1, omor1 and Ralph seem to be making progress so good luck to them!