Time Machine Backup on GNU/Linux

Time Machine for Mac OS is actually a nice backup tool that I use religiously (and that saved my data at least once from total annihilation) since it came out. But what I did not know is that you could pretty easily use a GNU/Linux based file server to hold your backups instead of plain old hard disks or Apples proprietary hardware solutions. Unfortunately though some of the descriptions of setting up such a system you find readily on the web are outdated, so I’ll try to provide a short write-up of the necessary steps (mostly for my own convenience).

  1. First, you’ll want to set up a GNU/Linux machine for the purpose if you don’t already have once. I went with the recent Debian Squeeze 32-bit distro and a software RAID-1 with two identical SATA hard drives.
  2. Then, install the netatalk package. It provides an AFP server that is recognized by the Time Machine software as a valid destination for storing backups. If like me you have at least one Mac that runs Lion, you’ll have to install the latest netatalk version 2.2beta or higher. I reproduce the description of how to achieve this painlessly on Debian from this thread:
    • add
      deb http://ftp.de.debian.org/debian unstable main

      to your /etc/apt/sources.list.

    • add
      Package: *
      Pin: release a=unstable
      Pin-Priority: 200

      to a new file in /etc/apt/preferences.d

    • update and install netatalk from Debian unstable:
      apt-get update
      apt-get -t unstable install netatalk
      
    • Now, we have to configure netatalk so that a Mac’s Time Machine application will have an AFP share that it can use for backing up your computer.
      1. First, I’d suggest you create a directory called TimeMachine or something similar that will be shared by netatalk as a backup volume.
      2. Uncomment the last line in the /etc/netatalk/afpd.conf file. You should have as the only non-comment line
        - -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword
        
      3. Finally we can add the share to /etc/netatalk/AppleVolumes.default by
        simply adding a line like

        /home/foo/TimeMachine TimeMachine allow:foo options:tm
        

        where foo is your user name. This config creates a share called TimeMachine that is usable as Time Machine backup volume (option tm) and can only be accessed by the user foo.

    • In Mac OS you can now mount the AFP share from your newly set up file server and select the mounted volume as backup disk in Time Machine preferences. Before backing up Time Machine will create a sparse bundle with the computer’s name.
This entry was posted in Tools and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *