Time Machine and Linux

Hard Drive - 2 Flash/Brolly by geerlingguy, on Flickr
Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic License by  geerlingguy

Previously I had written about using an Ubuntu server to host Apple Time Machine backups.   Now that I’ve retired the old server, I needed to re-do some of that work to get backups running again.  This time I decided to skip Part A – which was about enabling AFP to make it as Mac friendly as possible.  My new setup simply uses Samba to expose the previously created time machine volume as described in Part B of my old post.  This seems to be working just fine.

I learned the backup lesson the hard way, losing a 20Gig drive a few years ago.  There are in my office two dis-assembled hard drives: one which is the failed drive, and the second was a working same model number drive I bought on eBay.  The plan was to swap the controller board to hopefully save some of the data (it was my old web server).  It turns out that even though the drive models were the same, the internals were different – one drive had a single platter, the other a dual platter.  If this blog posting gives you that “yeah, I should really get my backup story sorted out” feeling, then go do something about it right now.  Hindsight is 20/20.

I meant to take a picture of that pair of drives to accompany this post, but failed to get a quick picture before I left the office.  I figured that I’d use the Creative Commons material from Flickr for this post.  It turns out that giving the correct attribution to the photo is a bit of a pain via Flickr (they should really fix that) – but there is a solution: www.ImageCodr.org.  With a few clicks and a cut and paste from the Flickr photo you want to use, you get an HTML snippet to use.

I had been using rsync to do backups on my old server, backing up from the main drive to one of the data drives.  As well, a number of the machines around the house would rsync backup over the network to the server.  On my new server I’m using rsnapshot, which is based on rsync but provides some nice scripting to give you a nice set of default behaviours.  Setting it up to do local backups from the server main drive to a mounted data drive was trivial.

Using rsync you can configure incremental backups – utilizing hard links to provide multiple full directory trees, with only a small increase in disk footprint.  Rsnapshot uses this facility to provide hourly, daily, and weekly backups – very similar to Time Machine’s backup story which as the data gets older, you get less granularity.  I’ve set it up with daily, hourly and monthly backups – after a few weeks it looks like this:

drwxr-xr-x 3 root root 4096 2009-04-21 00:30 daily.0
drwxr-xr-x 3 root root 4096 2009-04-20 00:31 daily.1
drwxr-xr-x 3 root root 4096 2009-04-19 00:30 daily.2
drwxr-xr-x 3 root root 4096 2009-04-18 00:31 daily.3
drwxr-xr-x 3 root root 4096 2009-04-17 00:31 daily.4
drwxr-xr-x 3 root root 4096 2009-04-16 00:30 daily.5
drwxr-xr-x 3 root root 4096 2009-04-15 00:30 daily.6
drwxr-xr-x 3 root root 4096 2009-04-14 00:30 weekly.0
drwxr-xr-x 3 root root 4096 2009-04-07 00:30 weekly.1

So while I’ve got many full file trees, through the use of hardlinks only 4.7Gig of storage is being used to have 9 copies of a 3.7Gig file tree.

One Response to “Time Machine and Linux”

  1. Roo’s View » Blog Archive » Cyanogenmod 7 and sshd Says:

    […] we’re done. The next logical step is to start including your phone as part of your nightly rsnapshot backups, or building some scripts to make updating music on the phone easy (and […]

Leave a Reply