It took me quite a lot and quite long time of experimenting before finding the proper way to do this, especially considering that Mavericks is a bit different from the previous felines… and that I was using Debian Squeeze…
I’ve finally been able to achieve it (and testing with file restore also), hence I’ve decided to document here my configuration hoping it will be of some benefit for others.
To be clear: this is a document to build a backup system “à la Time Machine” for your Mac based on Mavericks OS X 10.9.1 using a file share on Debian Linux and AFP protocol.
First of, some statements about false/deviating info I’ve found on other sites:
- You cannot use AFP with Mavericks, since it defaults to SMB2 ==> not true. I have a working configuration using AFP
- You can use whatever Debian/Ubuntu version, at worst you just tune your config ==> not true. At least not for me. It all started working when I moved from the previous Squeeze Debian (6.0) to the latest greatest Wheezy (7.0)
- It’s hard to configure the stuff, requires programming/scripting. Not true. Sure, you need to modify some configuration files on your Linux box… but if you are not able to vi some files, maybe you should think to have another operating system.
As said, please ensure your Debian Linux is at version 7.0 (Wheezy). If not, you should really consider to upgrade. It’s free, well documented, easy and it will save you tons of days and headaches trying to make bits behave 🙂
Second, ensure that the following two packages are installed:
- netatalk ==> to have your Linux talk AFP (Apple Filing Protocol) natively
- avahi ==> to have your Linux saying “bonjour” to an Apple networked machine. This is optional, since netatalk seems to include it in recent versions.
After upgrade to wheezy, I’m at the following releases (you can check with dkpg -s <package name> command):
netatalk is at version 2.2.2-1
avahi is at version 0.6.31-2
Now suppose that you want to backup your Mac to your Linux, where you have a shared disk bigger than your Mac internal HDD mounted in /media/mybigstuff.
First operation is to share this disk via samba, so that you can access to it from your Mac. I’m not detailing here how you should handle permissions and restrictions to user. Here’s what you should append to your /etc/samba/smb.conf file:
[MyTimeMachine] comment = Time Machine path = /media/mybigstuff browseable = yes writeable = yes read only = no guest ok = yes
Restart Samba service with command “service samba restart” to take new configuration into account.
Second, ensure you have a user on your Linux with same credentials of your Mac. Although not mandatory, this will greatly simplify operations. If you have a user called Appleseed with password AppLove on your Mac, issue the following commands in your Linux box to create a similar user:
useradd -d /home/appleseed -s /bin/bash -c "John Appleseed" Appleseed
mkdir /home/appleseed && chown Appleseed /home/appleseed && passwd Appleseed New password: <type AppLove> Retype new password: <re-type AppLove>
Now you should try to access to the Linux system from your Mac using samba protocol. From Finder, press CTRL+K and type in the appearing window the following string:
then click Connect (or + to add to the Favorites).
When prompted to authenticate, insert your password (and optionally flag to save it to Keychain) as shown below:
When the Finder window with the mounted drive appear, close it (was just to test that we did everything ok so far 🙂 )
Using Terminal, connect to your Linux box and edit the file /etc/netatalk/AppleVolumes.default and paste the line below at the end of the file:
/media/mybigstuff "MyTimeMachine" allow:Appleseed options:usedots,upriv,tm cnidscheme:dbd volsizelimit:640000
What you instructed Netatalk to do is basically the following: make /media/mybigstuff available as MyTimeMachine to user Appleseed as a TimeMachine volume of max 640Mb size.
Restart Netatalk service with command: service netatalk restart
Because this is not exactly an official Time Machine volume, we need to instruct our Mac to be a bit more tolerant.
Open Terminal and type the command
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Go into Time Machine, activate it and choose the disk you just defined as a backup disk, as shown below:
Optionally choose to encrypt the backup and confirm clicking “Use Disk”
Authenticate once and forever when prompted… et voilà, your system is now ready to perform backups onto the Linux share.
Enjoy and… remember to share your comments to confirm the beautiful experience, or correct mistakes I could have made in describing my setup!