Spam (madbodger) wrote,
Spam
madbodger

  • Mood:
  • Music:

data recovery

A while back, a friend of mine had his laptop drive lose a head right after his son was born. That drive had the only copies of the baby pictures. Ordinary disk recovery tools were flummoxed by having a large chunk of the filesystem gone. So I wrote some tools to recognize and recover contiguous files from raw data.

I started with some code I found on the web to recover JPEG files. It didn't work very well. It turns out that this code simply assumed that a certain byte sequence meant the end of a JPEG file. While it is the JPEG end-of-data sequence, that combination of bytes can occur elsewhere in the file, and it turns out that his camera happened to put that sequence in the JPEG header, resulting in all of the files from that camera being truncated.

So I coded up a smarter version, which actually understands the JPEG format. I also wrote code to find PDFs (he's a graphic artist, and Illustrator uses PDF format) and find PhotoShop documents. These programs recovered the majority of his lost files, including most of the baby pictures.

They're also useful for recovering data from corrupted or errantly reformatted or deleted Compact Flash cards and so forth. I'm making the source code available for others to use. JPEG tool: findjpeg2.c; PDF tool: findpdf.c; PhotoShop tool: findpsd.c.

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 11 comments