PhotoRec (from TestDisk) can revover lost files from harddisk, CD-ROM and camera memory. It works similar to foremost.

Table of Contents

Installation

PhotoRec is part of the testdisk package. testdisk is available on most Linux-based systems.

Usage

Using PhotoRec is pretty simple (run with ‘sudo’ or as root):

photorec <device>
# photorec /dev/sdb
  • If a disk image (e.g.: ‘mydisk.img’) is used, you don’t need to run PhotoRec as root.

The device needs not to be mounted. Specify a device name, not a partition name. You can also run photorec without arguments (in that case, you can choose which device to use).

Now, just follow the prompts: select if you want to search within a partition or all the disk, the filesystem type, whether to scan all space or only the free one and where you want to save the files (a new folder will be created, always use a different partition/device to save the recovered files). Notice the folder will be owned by the root user (you can change the owner later with chown command).

If you have any suggestion, feel free to contact me via social media or email.