Photorec & Testdisk

Testdisk

Repairing partition tables. Useful for a disk that no longer boots.

Photorec

Recovery of lost files (accidental formatting).

How to use it?

# bit-by-bit copy of a disc

dd if=/dev/disk of=/somewhere/big/enough/for/backup.img bs=4M conv=noerror,sync status=progress
  • if: read from FILE
  • of: write to FILE
  • bs: read and write up to BYTES bytes at a time
  • conv:
    • noerror: continue after read errors
    • sync: pad every input block with NULs
  • status: shows periodic transfer statistics
# you can also work directly on the physical disk
./photorec /path/to/backup.img
# file option > select the types of files you are looking for
# select the partition (whole disk)
# better if you know the type of filesystem where the files are located
# select the destination folder