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

  • Life's cusps

    I was just watching a romantic comedy* (like I do), and it finally dawned on me what my faint irritation is at most of these films. There comes a…

  • My life as a clip show

    For your amusement and mine, I gathered up a pile of video clips from my files and edited them together into a short movie. The order is random, the…

  • Hal Sparks, Serenity, Dr. Horrible at the Drafthouse!

    Hey, there are two fun events coming up at Arlington Cinema & Drafthouse! Saturday, June 27 at 1PM: The Annual Can’t Stop the Serenity Charity…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 10 comments

  • Life's cusps

    I was just watching a romantic comedy* (like I do), and it finally dawned on me what my faint irritation is at most of these films. There comes a…

  • My life as a clip show

    For your amusement and mine, I gathered up a pile of video clips from my files and edited them together into a short movie. The order is random, the…

  • Hal Sparks, Serenity, Dr. Horrible at the Drafthouse!

    Hey, there are two fun events coming up at Arlington Cinema & Drafthouse! Saturday, June 27 at 1PM: The Annual Can’t Stop the Serenity Charity…