Tuesday 18 January 2011

It had to happen sooner or later - I got a corrupted memory card

I thought I would share with you a great disk recovery application called PhotoRec (bundled with TestDisk)
Here is the blurb from the website:


PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory. PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media's file system has been severely damaged or reformatted.
PhotoRec is free - this open source multi-platform application is distributed under GNU General Public License. PhotoRec is a companion program to TestDisk, an app for recovering lost partitions on a wide variety of file systems and making non-bootable disks bootable again.
For more safety, PhotoRec uses read-only access to handle the drive or memory card you are about to recover lost data from.
Last weekend I carried out a portrait shoot using my 8 GB Sandisk Ultra II CF card.
I’d started to notice strange things happening a couple of months beforehand.
Having got home from a concert shoot and inserting the disk into my PC’s integral card reader, I was greeted with the message ‘This device is not formatted…do you want to format it now?’
Erm…NO!
I re-inserted the card into my camera and could view all of the images.
I tried again in the PC card reader… same problem.
Tried on my backup PC and it worked fine.
OK, it seems I have a faulty card reader.
This happened a couple of times on other shoots, and the card always read in my backup PC.
Occasionally, it worked in my main PC… until last weekend.
To make matters worse and to cause me to break out in a cold sweat, the card no longer read on the backup PC, displaying the same formatting message.
To my horror, it gave me the same message when I checked the card back in the camera.
It turns out I had a corrupted disk. This was probably caused by not ejecting the card correctly from the PC’s card reader.
 
After falling into the usual trap of downloading the promising freeware/shareware applications that taunt you with how many files they can recover, but only if you pay for the full version, I stumbled across this beauty of a free, open source application.


Not only did it rescue all my valuable lost images, it recovered images from the previous three shoots, even though a number of them were deleted on-camera at time of shooting and the card had been completely formatted in-camera a number of times.
As the official blurb says PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media's file system has been severely damaged or reformatted.’

My card ticked all the boxes!
The whole process took less than 20 minutes on an 8 GB card and gave me back the files in their original Canon RAW .CR2 format.

I’ve since tried it on other cards and recovered full shoots from formatted cards including images I remember deleting on-camera.

A sheer piece of genius if you ask me, and an absolute lifesaver.

I’ve detailed the process steps below with screen grabs, using a working but formatted card, so some of the information will look a little different to a totally Fubar’ed card.

Step 1:
Download the TestDisk/PhotoRec app for your operating system here: http://www.cgsecurity.org/wiki/TestDisk_Download
(You can download the full documentation from the site too)

Step 2:
The app is compressed as a .zip file, so you will need to unzip it:

 

Click through the testdisk-6.11.3.win folder (or equivalent for your operating system) until you see photorec_win.exe or equivalent.
In the Windows version, this is located in the sub folder named ‘win’


Step 3:
Click on the photorec_win.exe application to launch it.
The first DOS screen prompts you to select the correct media disk, in this case ‘Generic USB CF Reader’. Use the up/down arrows on your keyboard to select, then press Enter to proceed:


Step 4:
Next, select the partition table type (in the case of Windows, Intel/PC partition)
Again, use the up/down arrows and Enter key:


Step 5:
Next, select the partition. In the example shown, this is the FAT32 LBA partition labelled
[EOS DIGITAL] and press Enter to start the file recovery process:


Step 6:
To recover lost files, PhotoRec needs to know the file system type where the files were stored.
In this case, ‘FAT’


Step 7:
You now have two choices: to extract the files from free/unallocated space or from the whole partition. I would usually choose ‘whole partition’:


Step 8:
The next screen chooses a default download location for the extracted files (make a note of it!)
If you are happy with the default location and don’t want to change it, enter ‘Y’ for Yes:


Step 9:
You will now see a progress screen. An 8 GB CF card took around 15-20 minutes:


Step 10:
On completion, you will be able to view how many files were recovered and the location that PhotoRec has saved them to:


In this case, within the ‘win’ folder, PhotoRec created a folder called ‘recup_dir.1’
Depending on the size of the card and number of found files, there may be a number of folders;
‘recup_dir.1’ -  ‘recup_dir.2’ etc.
Below, you can see the retrieved Canon RAW .cr2 files in the ‘recup_dir.1’ folder:


Below is a screen grab of Adobe Lightroom displaying a few of the rescued Canon CR2 image files:


In summary, PhotoRec will help if you have a memory card with a severely damaged partition, if you accidentally formatted a card, or accidentally deleted an image.
There are some simple steps you can take to prevent card corruption:


1. Always format the card in your camera, not on your PC or Mac.
2. Always ensure the camera power is off before inserting the card.
3. Never remove the card from the camera when it still reading/writing (usually accompanied by a ‘busy’    L.E.D).
4. Never remove the card from your PC or Mac card reader when it is still reading/writing.
5. Always use the correct ‘EJECT’ procedure before removing the card from your PC or Mac.
6. Never play with memory cards when extremely drunk.

I've created a print quality PDF of this blogpost for you to download and save for future use.
Feel free to re-distribute, my logo is at the bottom of the PDFwith a copyright notice ;-)

The PDF can be downloaded from here:

http://www.camerastageleft.com/articles/Rescuing_lost_images_from_corrupted_card.pdf











 















  

3 comments:

  1. hi there, it's an interesting article you wrote here. I have a problem with some of the CR2 files in my laptop, which were copied from my Sandisk Ultra 8GB Compact Flash. Those files are somehow corrupted. they seem to be normal if you view them in thumbnail mode, but if you try to do zooming, they show all those red, yello, or green lines all over the RAW files. I've downloaded the software and installed it into my laptop. As i tried to recover with that software, somehow it didn't do anything. Could you please tell me what i've done incorrectly? Many thanks in advance :)

    -Edward-

    ReplyDelete
  2. Great thing, tried about 4 recovery programs and none of them succeeded, couldn't open RAW's but this nailed it.

    ReplyDelete
  3. This failed to recover my mistakenly deleted files. Actually I had imported them to LR already and then mistakenly deleted them. When I recovered them from the trash they all disappeared. Maybe because it was trying to restore to a USB drive?

    I used icarefree to recover the deleted files from the USB drive, but after recovery they were all corrupt and could not be read.

    I copied the recovered corrupt files to the USB drive and then used photorec_win to repair the recovered corrupt files and this worked.

    Thanks.

    ReplyDelete