Tuesday, October 25, 2011

Recover SD Card data in Linux

Deleted your family pictures on your camera by mistake?
You can recover them with the following procedure in Linux, (command line) given they weren't overwritten already.

Preemptive: You need to install gddrescue & testdisk

Sudo apt-get install gddrescue testdisk

1. find out to what device the SD card is loaded and where it is mounted.
Run in terminal screen (command line)


dmesg |grep sd

That will give you an output similar to this:
[61412.062714] sd 5:0:0:2: [sde] Assuming drive cache: write through
[61412.062719] sd 5:0:0:2: [sde] Attached SCSI removable disk
[63787.625910] sd 5:0:0:2: [sde] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
[63787.626657] sd 5:0:0:2: [sde] Assuming drive cache: write through
[63787.630555] sd 5:0:0:2: [sde] Assuming drive cache: write through
[63787.630564]  sde: sde1
This indicates that the SD card is known as device sde  (/dev/sde)

2. Create an image from your SD card onto your Hard-drive.

sudo ddrescue [/dev/device] [recovery image output] [logfile]

Example:

sudo ddrescue /dev/sde /home/user/Desktop/recoveryimage /home/user/Desktop/reclog.txt

3. Recover the images from the SD-card image file.

sudo photorec /d [photo output dir] [recovery image output file from before]

4. Follow procedure on the screen menu 

No comments:

Post a Comment

Please be courteous, even if you do not share the same view.