TestDisk

TestDisk is a free and open source, cross platform data recovery suite. TestDisk was written by Christophe Grenier in C and is capable of recovering files and partitions on FAT12, FAT16, FAT32, NTFS, and ext2 filesystems.

Installation
Installing TestDisk is as easy as running an emerge command:

The PhotoRec signature based recovery tool will be installed as part of the TestDisk suite.

Usage
TestDisk has a built in menu, so controlling it is a bit different than controlling other command-line programs. Start it by running:

TestDisk can work with raw disks created dd by using the following command:

PhotoRec
As mentioned above PhotoRec is a signature based recovery tool that installs alongside TestDisk. PhotoRec scans partitions for file header information in order to find lost or deleted files. Since file header information is queried PhotoRec can work on a variety of file systems and is capable of finding over 400 types of files. Files "found" by PhotoRec do not have their original file name; recovered data is grouped into folders and labeled with a file extension matching the header information (ASCII files are labeled *.txt, JPEG files named *.jpeg, PNG files named *.png, etc.). In order to find the specific file the content of each file must be searched.

Start PhotoRec by running:

Use the menu to achieve the options desired.

External resources
A TestDisk step-by-step guide.