Making backups of laptops is very important since you can lose it, have it stolen or most likely have a hard drive fail on you.
So I wanted to do a network backup of my MacBook running Mac OS X 10.7 codename Lion. Time Machine seemed like the right choice since it’s built in and very easy to used.
Since I already have an Ubuntu 11.10 codename Oneiric Ocelot I was going to have Time Machine put the backups on it.
First you have to install a couple of prerequisite packages:
- avahi-daemon (to advertise on the network that we can accept the Apple Filing Protocol, AFP, protocol which is used by Time Machine for backups)
- netatalk (free, open-source implementation of the AppleTalk suite of protocols)
Install netatalk (which is in the Ubuntu repositories):
sudo apt-get install netatalk
Next we’ll configure which folders we want to make available over AFP so edit the file /etc/netatak/AppleVolumes.default
sudo pico /etc/netatak/AppleVolumes.default
I commented out the home directory share and added the last line to specify which folder to use for the backups, the name of the share and the options:
# By default all users have access to their home directories. #~/ "Home Directory" /backup_folder "TMBackup" options:tm
Next I edited the /etc/netatalk/afpd.conf file since I wasn’t able to connect to the Time Machine share, I was getting a weird error saying
There was a problem connecting to the server "SERVER". Check the server name or IP address, and then try again. If you continue to have problems, contact your system administrator.
I fixed that by add replacing the last configuration line of /etc/netatalk/afpd.conf
sudo pico /etc/netatalk/afpd.conf
with the following line, which removes access by the guest user and adds password authentication for local users:
- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2_passwd.so -nosavepassword
Once that’s done, restart the netatalk service:
sudo service netatalk restartInstall the avahi daemon (if you don’t already have it):
sudo apt-get install avahi-daemon
In previous versions of netatalk, we’d have to provide a configuration file for the AFP service in /etc/avahi/services/afpd.service, but we don’t need to do that anymore since the newer version of netatalk takes care of advertising itself through avahi.
Restart the avahi daemon, just to make sure it’s running:
sudo service avahi-daemon restartNow on your Mac, if you didn’t enable network backups to devices other than the time capsule from Apple, run the following command in a Terminal window:
sudo defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
You should now be able to go into Finder -> Go -> Connect to Server -> Browse, and see your new time machine share. Select it in Time Machine and start backing up.
Notes
You can restrict which users have access to the time machine afp share by modifying the /etc/netatak/AppleVolumes.default config file and adding the “allow:” option with the usernames allowed to access the share:
# By default all users have access to their home directories. #~/ "Home Directory" /backup_folder "TMBackup" allow:username options:tm
Also make sure the folder selected for the backup folder has proper write permissions for the user(s)/group(s) which will make backups to it.
Sources
Michael Koflers Blog
Ubuntu Guide