While I have been avoiding Apple products personally because of their tendency to only work well together with other Apple products, I’m asked for advice on Mac-specific problems from time to time. This time a friend of mine is leaving the Apple ecosystem but still has his data backed up on an external hard drive with Time Machine and wanted to be able to copy his last backup to an NTFS filesystem.
What sounds like something easy to do, the way Time Machine and HFS+ work make it something you really have to wrap your head around first. You can’t just copy it to an NTFS drive with your Mac, because there’s no (freely availiable) write-support for NTFS. You can mount a HFS+ drive with a contemporary flavour of Linux, but Time Machine makes heavy usage of the Directory Hard Linking feature of HFS+ to implement the incremental backups. That means, if you have two distinct backups in which a specific folder didn’t change, instead of copying the data again, it is just linked to an older version of the same folder and therefore doesn’t need additional hard disk space.
While this is a smart trick, it is only supported by OSX so far. Linux systems don’t support Directory Hard Linking which makes it useless for this case. But luckily Alexandre Bique wrote a quick workaround for this: Time Machine Filesystem (thanks so much!). I’m doing a quick tutorial here to show how to use this.
Getting this done is quite easy after finding the right tool to do it. In this example, I’m working with Ubuntu 12.10 Quantal Quetzal.
There isn’t a ready-to-install package for installing tmfs, so we will build it from source, which is not too hard. First you will have to install some dependencies though – this might take some time, so grab a coffee while you’re installing.
# install dependencies sudo apt-get install libboost-all-dev cmake libfuse-dev # grab coffee
Now git clone the repository or just download the latest release and unzip it. Now you should be able to install like it is described in the readme file of tmfs:
# git clone the tmfs source git clone git://github.com/abique/tmfs.git cd tmfs mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. make DESTDIR=install-test make install # then if the installation looks ok to you in install-test/ do make install as root sudo make install
Hopefully everything worked out fine, so the only thing you have to do now, is mounting your partition. After plugin in your external hdd, Ubuntu should automagically mount it to some path starting with /media, for this tutorial, let’s assume it’s /media/myhfsplusdrive. To do it quick, let’s just mount it to /mnt. Also, replace myusername with your actual username twice.
sudo tmfs /media/myhfsplusdrive /mnt -ouid=$(id -u myusername),gid=$(id -g myusername),allow_other
If everything worked out how it should, you should now be able to transparently get all your files via /mnt. It shouldn’t be any problem to copy the data there to i.e. an NTFS drive via rsync, finder or whatever you prefer.