Search & Rescue: SD Card Recovery

So I had a great day at Mozilla Festival (MozFest) yesterday. I was there covering the event for Linux Format. I interviewed lots of great people and took lots of photos....and here we have a problem.

My old camera, a Canon EOS 300D is an old digital SLR camera, and it works really well and still takes a good picture. But last night I turned the camera on while on the train, and to my horror the camera crashed and became unresponsive. "Don't panic" I thought,but I wouldn't be re-assured until I got home to see the pictures on my laptop.
I got home at around 1 am and placed the SD card into my Ubuntu laptop.
I saw this error when I mounted the SD card

alt

My first thought, well it isn't something I want to type for a child to read, but anyhow I wasn't happy!
So I went to bed, I'd been awake for 21 hours and I wasn't in the best frame of mind to tackle a data recovery job.

I woke around 8 am and with a coffee in hand I did a bit of Googling.

After a few minutes I was reminded of an application called photorec part of an application suite called testdisk that specialises in data recovery from physical media. So on my Ubuntu laptop I opened up a terminal and entered the following to install the suite.

sudo apt install testdisk  

With testdisk installed we can use the photorec command from the terminal.

sudo photorec  

alt With photorec open we can now select the drive that we wish to recover. In my case it was my SD card in /dev/mmcblk0

alt We now see the partitions on that drive, I had 1 partition where I stored the pictures.

alt Now we need to tell photorec what the filesystem was for my SD card, typically cameras use FAT / NTFS so I selected other to cover those filesystems.

alt Next we tell photorec to check for files on the whole partition.

alt Our next goal is to specify where the recovered files need to be stored. This can be anywhere on your computer. When you have found the correct location use Enter to go into that directory and then press C to start the process.

How long it takes depends on how much data there is to recover. So best to get a cuppa and wait for it to complete.

Epic Win!

alt alt Luckily I recovered all of my images, phew!No I didn't take 14371 pictures, the tool also recovered lots of text files and thumbnails.