Life & Technology

June 23, 2008

Time Machine on Linux

tux on a time machineRecently after switch­ing from Mac OS X to Debian, I found I needed to restore a couple files from the Time Machine backup that I kept. The drive works just fine as an HFS+ mount, but I couldn’t figure out how to retrieve any­thing within. When Google didn’t yield the answer, I began to explore on my own. Turns out Apple does a couple slick things with the file system to make incre­men­tal back­ups work.

So for anyone that needs to access their Time Machine from some­thing other than its asso­ci­ated Mac, here’s how you do it:

Mount the drive. On linux it should auto­mount if you have gnome-volume-manager installed. If you don’t see it in /media then run nautilus and check the desk­top. Still don’t see it? Read man mount. And then don’t forget the -t hfsplus flag.

Change direc­tory. My mount point is /media/Time Machine/. Within that path I find the direc­tory Backups.backupdb/. This rep­re­sents the direc­tory layout of your backup system. Inside that direc­tory is the name of your disk. Inside that are fold­ers labeled with dates cor­re­spond­ing to each incre­men­tal backup that was made. Pick the one you want, or choose the Latest sym­link. For exam­ple, my path is now:

/media/Time Machine/Backups.backupdb/Drive\ 1/2008-06-05-073745

Find your file’s folder. Within that path is a com­plete rep­re­sen­ta­tion of your filesys­tem. Nav­i­gate to the loca­tion of your file. If it’s not too big or nested too deep, it may be plainly vis­i­ble. How­ever there’s a good chance that its parent direc­tory doesn’t exist. Instead you’ll see a zero-​byte file for the parent that takes its name and acts as a pointer. Run ls -l and take note of the first num­bered column. Example:

...
-r--r--r-- 2155704 root 5791966       0 2007-06-25 02:54 Wallpaper
-r--r--r-- 2155725 root 5791967       0 2007-06-25 02:54 Web-Identity
-r--r--r-- 5441953 root 5791968       0 2007-06-25 02:54 Windows
-r--r--r-- 5511926 root 5791969       0 2007-06-25 02:54 Work

After the per­mis­sions you’ll see the direc­tory number that typ­i­cally refers to the number of direc­to­ries within that folder. For a file it should always be 1. Here it is not. What Apple has done is adjust the infor­ma­tion in this file’s inode to use it as a pointer to the direc­tory that con­tains the actual file. That way mul­ti­ple revi­sions of the same drive can coex­ist with­out dupli­cat­ing data.

Find the data. So in my case I want to grab some­thing out of the Wallpaper folder. First I make a note of the direc­tory number, 2155704 and then cd /media/Time Machine/.HFS+ Private Directory Data. This is where the data really lives. From there just cd dir_2155704 and voilà!

June 19, 2008

Biomorphs

Recently I came across an aca­d­e­mic ref­er­ence to Clif­fard Pickover’s bio­morphs, a gen­er­a­tive fractal-​like art that resem­bles cell struc­tures. Out­side of Richard Dawkins’ famous evo­lu­tion­ary inven­tion of the same name, which is sim­i­lar in pur­pose but dif­fer­ent in design, I had never heard of Pickover’s work. Sadly I couldn’t find the orig­i­nal arti­cle for free. [Bio­morphs: Com­puter dis­plays of bio­log­i­cal forms gen­er­ated from math­e­mat­i­cal feed­back loops]

I did, how­ever, find a good overview of the sub­ject by Mad Teddy. [Explore his web­site to dis­cover why he is, in fact, quite mad.]

Ten min­utes later I gen­er­ated my own biomorph:

biomorph.jpg

Down­load the source code as an Xcode project (Mac only, 51 KB). Pos­si­ble improve­ments, includ­ing ani­ma­tions, to follow.