Sunday, September 27, 2009

Setup of a Linux TimeMachine backup server, accessible from OS X

I've found a couple of sites that describe a procedure for defining a networked TimeMachine Volume using Ubuntu Linux.

The last one is very clear and complete. This is a summary of the commands I used for configuring Ubuntu 9.04.

Update: seems that this procedure also work for Ubuntu 10.04. After upgradind the server I could not mount the shares and received the messages:

Jul  5 09:04:35 machine afpd[18138]: cnid_open: dbenv->open of /home/user/TimeMachine/.AppleDB failed: DB_VERSION_MISMATCH: Database environment version mismatch
Jul  5 09:04:35 machine afpd[18138]: Cannot open CNID db at [/home/user/TimeMachine].
Jul  5 09:04:35 machine afpd[18138]: Fatal error: cannot open CNID or invalid CNID backend for /home/facciolo/TimeMachine: cdb
The database contained in the .AppleDB directories has changed format. The solution is to remove it (See:

1) Install and configure packages in Ubuntu 9.04
apt-get install netatalk
apt-get install avahi-daemon
apt-get install libnss-mdns

Edit: /etc/default/netatalk

Append to: /etc/netatalk/afpd.conf
- -transall -uamlist, -nosavepassword -advertise_ssh

Edit: /etc/netatalk/AppleVolumes.default
~/ "$u" allow:username1,username2 cnidscheme:cdb

/home/username/TimeMachine TimeMachine allow:username1,username2 cnidscheme:cdb options:usedots,upriv

Do not forget to create the backup directory:
mkdir /home/username/TimeMachine

2) Configure avahi and start services (Ubuntu)

Edit: /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns

Edit: /etc/avahi/services/afpd.service

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<name replace-wildcards="yes">%h</name>

Start the services:
/etc/init.d/netatalk restart
/etc/init.d/avahi-daemon restart
By now the network drives (home and TimeMachine) should be visible from OSX Finder.

4) Enable networked TimeMachine Volumes in OS X
In a terminal run:
defaults write TMShowUnsupportedNetworkVolumes 1

5) Create a disk image for the first use of TimeMachine
5.1) Obtain the MAC address (ifconfig -a) here marked as XXXXXXXXXXXX:
en0: flags=8863.....
5.2) Obtain the computer name (hostname -s) : mycomputer
5.3) Create the image with Disk Utility
  1. New Image
  2. Set the image name to : mycomputer_XXXXXXXXXXXX.sparsebundle
  3. Set Image Format to: sparse bundle disk image
  4. Set Volume Size to: Custom
  5. Create and save the image on the LOCAL drive (not the networked one)
  6. Copy the image to the networked drive and erase the local one

6) Choose the TimeMachine network drive and backup.
You may also want to change the backup interval (3600 sec by default):
Edit the file /System/Library/LaunchDaemons/

No comments:

Post a Comment