How to recover deleted files from an SD card

It has happened to me a couple of times that I have accidentally deleted a group of photos since in the contextual menu of Thunar, "Delete" is very close to "Copy" and the application is not very questionable; directly delete.

Not to despair, here is the solution.

This is a contribution from Agustín Kanashiro, thus becoming one of the winners of our weekly competition: «Share what you know about Linux«. Congratulations Agustín!

The first thing is that immediately after deleting the files, DO NOT copy anything to the SD memory.

Installation

First you have to download testdisk either by doing apt-get install testdisk or pacman -S testdisk.

Create an image

From the command line, we create a disk image of our SD card. We must have enough disk space to do it.

dd if = / dev / DEVICE of = memory_card.img bs = 512

Where DEVICE is the SD card reader. In my case it is mmcblk0.

This is obtained by doing:

sudo fdisk-l

We will get something like this:

Disk / dev / mmcblk0: 3965 MB, 3965190144 bytes
49 heads, 48 ​​sectors / track, 3292 cylinders, 7744512 sectors in total
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical / physical): 512 bytes / 512 bytes
I / O size (minimum / optimal): 512 bytes / 512 bytes
Disk ID: 0x00000000

Recover files

In a terminal we write:

photorec memory_card.img

The application is quite simple to use and the utility gives the option to recover all the files, but does not recover them with the original names. Also, the most important thing is that they can recover the files. 


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   agustin said

    On the cell phone, how do I recover the music and photos?

  2.   Gaius baltar said

    You plug the SD into the computer and follow the process. If you talk about the internal memory, because I do not know if you do not explain it, so I interpret it, you plug the cell phone into the PC, pray that it appears as a disk and try the same process ... xDD

    Luck 😉

  3.   pako said

    Thank you! Resolved doubt, even so I will avoid lending, or losing my things.

  4.   Jakeukalane Milegum Firisse said

    It worked for me a long time ago to recover about 100 photos from when I traveled to rep. Czech. It's great 😀

  5.   Jakeukalane Milegum Firisse said

    editing a 1 by 1 image or file, emptying it and saving 2 times

  6.   pako said

    And I have a question ... how do I permanently eliminate something? That even with this method it is recoverable? At the time of lending my memory, be it from work, school or something and I don't want my files recovered? Obviously without the formatting

  7.   Gaius baltar said

    Sorry Pako, but that's impossible ...: _D It will only be removed "completely" when it has been written above.

  8.   Javier said

    Thank you very much, you have saved my marriage 😉

  9.   Monica said

    Help:
    To recover photos from a PSP, is it the same procedure ??? I think you have a Produo

    mill thanks

  10.   Christi said

    Recover files and photos… but I don't know how to do it… .help

  11.   David said

    Excellent ! Excellent ! you have saved my skin !! fully recommended

  12.   Alberto J. Caro said

    Good application and better yet the explanation. Thanks for the input. I have managed to recover deleted photos and videos.

  13.   Agustí said

    I have been able to retrieve all the documents on the card. Thanks a lot