Sunday, 15 February 2009

TestDisk: *the* cross-platform data recovery tool

A few months ago, I lost both disks at the same time in the RAID 1 mirror running on my QNAP TS-209!

I get the feeling hardware manufacturers that extol the virtues of RAID would like you to believe that this sort of event is extremely uncommon. However, judging by how hot the disks were running (I couldn't hold them for more than a few seconds comfortably) the likelihood of both failing was probably quite high. The QNAP's cooling fan obviously wasn't able to provide sufficient airflow over the disks in question (a couple of Hiatchi
Deskstar 1Tb 7K1000's) which probably had a lot to do with the failures and data corruption. In hindsight, I'm amazed they lasted as long as they did.

I had been running an rsync job between the QNAP and my main PC fairly frequently. Just prior to the disk fatalities I'd been running short of disk space on my main machine and hadn't run the sync job for about six weeks. Annoyingly, when it failed there were still some files on the QNAP that I wanted.

At the time I had a brief search around for some free data recovery tools using all of the keyword variations you might expect to pull up something useful via a search engine. I tried a few I came across and was left distinctly unimpressed by what was on offer. So, I decided to shelve the disks until I could find the time and a suitable tool to try and get at least some of the data back.

Then, last week, I came across Victor Stinner's excellent library, hachoir. On that project's wiki I noticed the rather intriguing entry simply
titled 'forensics' which in turn led me to the TestDisk homepage.

What a find!

I haven't been more impressed with a bit of software since someone introduced me to VLC several years ago. TestDisk runs on an impressive array of platforms (Linux, BSD, Solaris, Mac OS X, Windows) and supports the drive formats you'd expect to come across - FAT12/16/32,
NTFS, EXT2/3, ReiserFS etc. I was running TestDisk on Windows Vista 64-bit retrieving data from an Ext3 partition.

Even better, it's free (GPL licensed). I think you'd be hardpressed to find a better free tool. Even paid for tools would likely struggle to match TestDisk's impressive list of features. I'm frankly astounded at how hard it is to find such a good tool via a search engine unless you know it by name (which is ridiculous).

This tale does have a happy ending. I managed to retrieve about 80% of the files for what I believe is only some partition corruption. I've yet to ascertain if there is any physical damage to the disks. TestDisk was able to dig up the partition table that the QNAP managed to trash somehow and even allowed me to get back copies of files that had previous been deleted when the disks were still functioning. Truly amazing. I'm also hoping there is some life left in my Hitachi Deskstar disks. Mind you, I intend to give them a thorough soak test before trusting them with any serious data.

I really recommend checking out the TestDisk web page and downloading it if you have spare 5 mins.

A big thank you to Christophe Grenier for all his efforts in creating a truly great piece of software!