Using Ubuntu for Time Machine in Snow Leopard

Over a year ago Matthias Kretschmann posted an excellent guide on how to use Ubuntu as a Time Machine backup server. The guide is quite well written all the configuration steps worked, but I received Error 45 creating backup disk image when Time Machine ran. Some more research revealed that this is because of changes to the sparse bundle image in Snow Leopard.

To make it work I had to create my own sparse bundle with a plist file in it to associate my MacBook’s unique id with the time machine image. Leopard and earlier releases of OS X would create a sparse disk image with the name from the network cards mac address, but in Snow Leopard it uses the computer Hardware UUID. I imagine this is because notebooks can have more than one mac address, one for wired and one for wireless.

How to create a sparse bundle in Snow Leopard

Step 1: Create the disk image with your computer’s name:

hdiutil create -size 500G -fs HFS+J -volname 'Time Machine Backup' -type SPARSEBUNDLE computer_name.sparsebundle

Step 2: Create a file called inside the sparsebundle folder and fill it with the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Make sure you replace UUID_STRING with your unique machine identifier. This can be found by loading System Profiler (Hardware UUID).

Step 3: Transfer the sparse bundle disk image to your Ubuntu computer:

rsync -avP computer_name.sparsebundle username@ubuntumachine:~/

3 thoughts on “Using Ubuntu for Time Machine in Snow Leopard”

  1. Warning: See Posting from

    Non-Apple AFP can be dangerous with time machine…
    Authored by: dbs on Thu, Sep 24 2009 at 11:58PM PDT

    Everyone should be aware that using Time Machine on a Non-Apple AFP volume via these hints
    may put their backup data at risk. Here’s why:

    The technical reason why Apple limits Time Machine to 10.5+ AFP volumes appears to be to
    prevent disk image corruption. There were additional features added to AFP in 10.5 to
    support Time Machine. These presumably allow the disk image engine to force disk image
    journal data to write out all the way to the disk. Without such features, a network
    interruption can result in a corrupted filesystem on the disk image despite journaling.
    Remember, journaling relies on the journal being written all the way to disk before the
    changes take place. If you can’t guarantee that (e.g., because of network/NAS buffering)
    then the journal is useless. Time Machine appears to rely heavily on disk journaling to deal
    with network drop-outs, interrupted backups, and the like. Take this away and your data is
    at risk.

    If the NAS you are using supports these features it should report them to the OS and you should natively be able to choose that volume. If you have to trick the OS to use the volume it means the NAS does not support it. That trick usually involves the following one long command line:

    sudo defaults write TMShowUnsupportedNetworkVolumes 1

    So, the safer way to do this is to setup a 10.5 or 10.6 box and share via AFP.

  2. Regarding “using Time Machine on a Non-Apple AFP volume may put their backup data at risk”:

    This caveat may be out of date – you can check yourself.

    If you are using Netatalk version 2.0.5 or better, this has the special new features added to avoid Time Machine disk corruption. If you have a version of Netatalk earlier than 2.0.5 (e.g. Ubuntu 9.10 currently has 2.0.4), then you are at risk as described.

    If you have Netatalk 2.0.5 installed, you should add the option “tm” to any share you use for Time Machine, in the AppleVolumes.default config file.

Leave a Reply

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