Skip navigation.

Ubuntu Linux: Recover images from your digital camera flash card

I mentioned earlier that after my last trip to Hong Kong and the aviary in HK Park, a silly manipulation mistake caused me to lose my most prized pictures, close up shots of exotic birds.

What happened is that I had already taken 9,999 pictures with my Nikon D70 camera and that the camera rolled over to 1, placing the newest pictures in a different folder in the flash card. When I downloaded the pictures from the camera to the computer, instead as usual of using DigiKam which I am sure would have handled this properly, I copied the images manually using the command line. I had failed to notice the new directory and only downloaded the pictures from the original directory. After that, I used the camera menu to format the flash card. Thus, all my favorite pictures from this trip, which were among the latter pictures, were lost. Or so I thought at the time.

I kept in mind that there may still be a small possibility to recover the missing pictures using some disk recovery tool. Fortunately, I had noticed my mistake very quickly and had the presence of mind of not using that same flash card to take pictures until I had at least tried to recover the pictures.

As it turns out, recovering the pictures was very easy. It was simply a matter following the existing Ubuntu data recovery documentation.

What I did is precisely this:

  1. Install gddrescue and foremost.
  2. Put the flash card into my camera and connect the camera to the computer, without actually mounting the camera's flash card.
  3. Create a target directory: mkdir nikon_recovery
  4. Having identified /dev/sdc1 as the camera device, create as root an image of the camera card: ddrescue -r 3 /dev/sdc1 nikon_recovery/image nikon_recovery/logfile
  5. Get the pictures from the image file: foremost -i nikon_recovery/image -o nikon_recovery/
  6. Change the file ownership from root to the regular user.
  7. Browse the nikon_recovery/jpg/ directory with any software: all the pictures were there with EXIF data!

I was surprised by two things:

  1. Recovering pictures from a flash card I thought I had formated with the camera's build-in tools was much, much easier than I had anticipated.
  2. I actually "recovered" more photographs than I bargained for. Not only I had my HK pictures, but I also had a copy of very old pictures I thought had been formatted and written over many times since I actually took them! So, beware of privacy issues.

Now, back to my HK birdie pictures: my status as a bad photographer is confirmed, but the conditions in the aviary are so good to take close-up shots of rain forest birds that even me managed to take a handful of, not exceptional, but at least publishable pictures. I'll crop some of them and create a small gallery here, hopefully soon.

Thanks

Thanks for the info, it was very useful for me :) I will re-blog it ;)

Linux web site

From now on, I'll be posting everything that's related to Linux onto the new Linux web site:

http://linux.overshoot.tv/

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Use [fn]...[/fn] (or <fn>...</fn>) to insert automatically numbered footnotes.
  • Allowed HTML tags: <a> <em> <strong> <blockquote> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically. (Better URL filter.)

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.