TestDisk & PhotoRec are two tools used to recover data from damaged or failing disks and memory cards. TestDisk can scan disks and recover partitions, repair boot sectors, and much more. PhotoRec scans partitions (such as a failing or corrupted SD card) to recover files.
Both are extremely powerful, useful, and licensed under the GPL v2+.
From the TestDisk page:
- Fix partition table, recover deleted partition
- Recover FAT32 boot sector from its backup
- Rebuild FAT12/FAT16/FAT32 boot sector
- Fix FAT tables
- Rebuild NTFS boot sector
- Recover NTFS boot sector from its backup
- Fix MFT using MFT mirror
- Locate ext2/ext3/ext4 Backup SuperBlock
- Undelete files from FAT, exFAT, NTFS and ext2 filesystem
- Copy files from deleted FAT, exFAT, NTFS and ext2/ext3/ext4 partitions.
From the PhotoRec page:
PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory. PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media's file system has been severely damaged or reformatted.