Ubuntu with Apple’s Time Machine

timemachineOnce I had managed to get Leopard up and going on the mac mini with all of the user settings copied over, it was time to start exploring new features.  Time Machine was first on the list – but I wanted to have it back up over the network to my Ubuntu Linux server.  I probably took the long route to a solution, but what I have seems to be working.  The two main parts of getting time machine to work are: a) make it so the Mac can see the network storage b) trick time machine into using it as a destination.

Part A – I believe that you can use a non-AFP network storage solution (and my Mac can see my Samba volumes for shared files) but I went the route of enabling AFP.  This is based on instructions found here, but I’ll repeat it here with my comments:

  1. We’ve got to recompile netatalk to have encryption.  You’ll need the universe repository enabled, and the development tools.  Details can be found in the ubuntu forums.
    sudo apt-get install dpkg-dev
    sudo apt-get install devscripts
    sudo apt-get install libssl-dev
    apt-get source netatalk
    sudo apt-get build-dep netatalk
    sudo apt-get install cracklib2-dev
    cd netatalk-2.0.3
    DEB_BUILD_OPTIONS=ssl debuild
    sudo dpkg -i ../netatalk_2.0.3-3ubuntu1_i386.deb

    You’ll probably want to issue a ‘hold’ on the netatalk package by using dpkg –set-selections to prevent being upgraded
    For the lazy – here is a link to the .deb I created.
  2. Modify the configuration file /etc/netatalk/AppleVolumes.default to point at the location you are going to store files.  Ensure ownership and permissions are correct for the user you want to have access this location.
  3. Now we install avahi
    sudo aptitude install avahi-daemon
    Edit /etc/netatalk/afpd.conf to contain:
    - -noddp -uamlist uams_randnum.so,uams_dhx.so
    you might add -noslp to that line above to remove a warning, the key is that the configuration must be on a single line.
    Edit the hosts line in  /etc/nsswitch to match
    hosts: files dns mdns4
    Download using wget http://www.disgruntled-dutch.com/media/afpd.service
    and install that in /etc/avahi/services
    Restart the services:
    sudo /etc/init.d/netatalk restart
    sudo /etc/init.d/avahi-daemon restart

At this point your Mac should be able to discover the service and see the volume as a shared drive.

Part B – Tricking the Mac into using this volume as a backup.  You may not need to do any of the work in Part A at all as is evidenced by other people claiming success on the net.

  1. Create a file named “.com.apple.timemachine.supported” at the root of the filesystem we pointed at in (2).  I’m not entirely sure this is required, but it didn’t hurt.
  2. On the Mac we need to fiddle one default.  Enter the following command in a terminal:
    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
    At this point, Time Machine would connect, but then fail with the error message: “Time Machine Error – Backup disk image could not be created”
  3. The ReadyNAS folk had a solution that worked for me.  Create the backup volume locally on the Mac and move it to the network volume:
    Determine your hostname, hopefully it is a simple one.
    Issue the command “ifconfig en0 | grep ether” which will find the MAC address of your Mac.
    Using <hostname>_<mac address>.sparsebundle as the filename we create a new volume:
    hdiutil create -size 140g -fs HFS+J \
    -volname "Backup of magpie" \
    magpie_0016cbaf91d7.sparsebundle

    Copy the newly created “sparse bundle” to the network volume.
  4. Now start up Time Machine – you should be good to go.  I opted to leave SpotLight enabled, this did significantly slow down the backup performance – but I do want the ability to search for “lost” files from the backup.

Time Machine is pretty weird.  I had assumed (wrongly) that it simply gave you a file view in time.  It turns out that many of the Mac applications are time machine aware, and will show you a views of the past.  For example, you can view your email through time and recover the mailbox from the past.

[Edit: April 2013 – it’s been some time since I stopped using this solution. I experienced this failing twice for me in basically the same manner. When the timemachine volume would get full my backup would stop being accessible. Instead of spend more time figuring out what exactly was wrong, I’ve moved onto an rsync (rsnapshot) based solution].

Mac Mini Upgrade

We joined that big happy Apple family back in January of 2006.  I picked up a refurbished Mac Mini (1.25GHz PowerPC, 256MB RAM, 40Gb drive) along with a copy of OSX Tiger and iLife 2006.  I immediately upgraded the RAM to the maximum 1Gb, and over time we’ve added a camera, USB multi format card reader and the other usual add-ons.  For the most part, the Mac Mini has done exactly what we’ve asked of it.

Along comes 2009, and we’ve got a 9megapixel digital camera a collection of digital music that tops 4000 songs (yeah, tiny for some) – but this was starting to seriously tax the modest 40Gb drive in the mini.  It was time to upgrade.  While terabyte drives are nearing the $100 mark, the mini uses an 2.5″ IDE drive – and for folks in the same situation, beware these are starting to be harder to track down as SATA drives are the new norm. I was able to find a 160Gb 2.5″ IDE drive locally at Everbest – a tiny independent shop that seems to have great prices and stuff in stock.

Since I figured the hardware upgrade was going to be fairly invasive, why not take this chance to upgrade to OSX leopard?  The primary driver here was to start using Time Machine to provide easy backups.

Step 1 – make sure we’ve backed up the system before we start messing with it.  Apple has some documentation on doing this manually.  You’ll also probably want to enable root if you haven’t done that yet. I just copied everything to a drive in a USB enclosure.

Step 2 – You would think the hard drive swap was the hard part, but it was actually very easy – I did it in about 15mins.  There is a very detailed write up on this process that I found which helped, for the one screw which is blocked by tape I just shoved the screwdriver through the tape and resealed it with a new bit of tape after I was done.

Step 3 – This is where I sort of went off the rails.  Originally my plan was to use the instructions I found for manually upgrading – unfortunately this just didn’t work.  Looking back, it was probably my fault that it didn’t work but the clock was ticking – as the Mac is Jenn’s machine I can’t have it in a non-working state for very long.

I hit a few interesting problems in my software install frenzy.  I managed to get a bogus disc in the slot loaded drive, one which didn’t boot – and as the hard drive had no OS on it either, it wouldn’t let me eject it.  The solution here was to boot into the open firmware and issue an eject command.  Before I even got started on the OS install, I needed to format the disk – I wasn’t sure which of the filesystem options to choose.  It turns out the ‘right’ one for my needs was the Extended Journaled, if you want more of a Unix like experience you want to choose Extended Journaled & Case Sensitive.

After the first multi-hour install session (hey, the mac mini isn’t speedy) as I mentioned I had botched the manual migration.  Where did I go wrong?  Well, I had not used exactly the same password – so my keyring was busted, this broke email and web browsing.  As well, in my rush I had apparently the wrong versions (I failed to run the update manager) of iTunes and iPhoto so they had data format problems.  At least I still had the original 40Gb drive untouched.

migrationassistantThe new plan – buy a 2.5″ USB enclosure for the old drive, and use the migration assistant.  So I got to enjoy the process of doing another clean OSX install, but this time the migration assistant was happy to move data from the old drive hooked up via USB.  The manual backup I had performed before was not eligible for use with the migration assistant (it wasn’t a complete copy of the OS, just the user data).  I was conservative with the migration, so a few of the extra apps (Adium) didn’t completely move over – but a quick re-install fixed that up.

So I finally succeeded, once again learning the lesson: Its the Apple way or the Highway.  The new drive has plenty of free space, is dead quiet and also faster than the old one (5200rpm vs. 4200).

World of Goo

world_of_goo1

I caught sight of World of Goo while browsing slashdot of all places. It turns out that a Linux version of it was recently made available, so I had to give it a shot.

The style reminds me a lot of Tim Burton’s movies.  The gameplay is similar to fantastic contraption mixed in with lemmings.  I’ve only played for a few minutes to get a feel for it, I suspect it gets a lot more challenging as you go on.  The little bit I did play, impressed me enough to want to tell others about it.

There are versions for Linux, Mac and Windows – as well as Wii.  If you’ve got any interest in puzzle games, give this one a spin.  Kudos to 2D Boy for  making a cool cross platform game – nice to see that a small team with a vision can still make a go of it.