In this tutorial, let’s assume that we have accidentally deleted our files, from an sd card, or a USB thumb drive. Then we will try to recover them using photorec app.
First, we connect the SD card, or the USB thumb drive to our Linux PC and gather some info, like where it is mounted and it’s file system format.
Now let’s imagine a situation where we had this SD card in a smartphone and that we accidentally deleted those files. So naturally, the connected SD Card would look like empty. Before we start, the recovery procedure, it is recommended to create an empty folder, in our home folder.
In this tutorial, I created an empty folder named “recover” which I will use as a place holder to recover the deleted files from the SD card. While in a terminal window, we can check with the
command the same info that was presented by the disk app.
Assuming that you have photorec app installed, just type
in the command line and press enter.
Choose the appropriate mount point of the SD card and press enter. Then select the appropriate filesystem type of the SD card. Then select either the free space, to be scanned for deleted files or the whole partition.
Lastly, choose the empty folder, that you have created previously, in your home folder, as this is the place where the recovered files will be stored. Press C, when the destination is correct and sit back and let the procedure be complete. Once it is complete, select Quit, on all prompts and press Enter.
Now you can go to the recovery folder and copy back your files to the SD card.
Here is the video tutorial: