Search This Blog

Tuesday, December 27, 2011

Apple TimeMachine backup to Ubuntu 11.10 over network

Time Capsule is a great way to backup your MacBook over the network.  But at $500 for the 3 terabyte version, why spend the money when you have an Ubuntu 11.10 media server with 6 TB of storage and an Airport Extreme base station (which is 1 of the 2 things the Time Capsule accomplishes)?  It does take a little bit of configuration to get it running, so here goes:

1) In the terminal, install netatalk so that your Ubuntu machine will communicate via AppleTalk.  While you're there, make sure that avahi-daemon is installed (it is by default on 11.10):
sudo apt-get install netatalk avahi-daemon

2)  Now edit the afpd config file (AppleTalk Filing Protocol) so we can communicate with the directory properly over the network.  To see a description of each option, view the afpd website or "man afpd" in terminal:
sudo gedit /etc/netatalk/afpd.conf
Add this to the bottom of the file:
- -tcp -noddp -uamlist,, -n

3) Create the directory for you TimeMachine backups:
mkdir /dir/dir/YourBackup/Folder
I chose /media/Backups/macbook/TimeMachine

4) Edit the permissions for that folder so that everyone can have read/write access.

5) Edit the netatalk AppleVolumes.default file to point to your directory:
sudo gedit /etc/netatalk/AppleVolumes.default 
/media/Backups/macbook/TimeMachine "TimeMachine" cnidscheme:dbd options:usedots,tm,upriv
The "tm" enables for TimeMachine use.  This page details all the options for AppleVolumes.default

6) Tell the avahi daemon to broadcast AppleTalk over the network:
sudo gedit /etc/avahi/services/afpd.service
This will open an empty (hopefully) file.
Enter the following, save, and close:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
  <name replace-wildcards="yes">%h</name>

7) Restart the services to read in the new config files:
service netatalk restart
service avahi-deamon restart

8) In order to not fill all of the hard drive space on the Ubuntu server with MacBook backups, create a disk image from OS X:
Disk Utility > New Image
Create whatever size image you'd like.  This will look like an external hard drive to TimeMachine, which it will fill until it is out of space, and then start replacing the oldest data first.
Save this to your networked folder on the Ubuntu server (/media/Backups/macbook/TimeMachine/backup.dmg)

9) On the Mac, select the Go menu > Connect to Folder > Browse > TimeMachine

10) Enable TimeMachine and see if that drive is available.  If not, I found this small hack for OS X on
defaults write TMShowUnsupportedNetworkVolumes 1
Enter that into your terminal and try again.

No comments:

Post a Comment