TestDisk & PhotoRec

A handy application that is able to check and undelete partitions, as well as perform recovery and repair tasks for damaged disks.

Download Now

TestDisk and PhotoRec are powerful open-source tools used for data recovery. Here’s a concise but thorough guide on how to use each tool effectively.


🧰 What They Do:

  • TestDisk – Recovers lost partitions, makes non-booting disks bootable again, and can also undelete files from FAT, exFAT, NTFS, and ext2.
  • PhotoRec – Ignores file system structure and looks for known file headers, making it excellent for recovering lost files (photos, documents, videos, etc.).

✅ Before You Begin:

  1. Install TestDisk & PhotoRec:
    • Windows: Download from https://www.cgsecurity.org, extract the ZIP file.
    • Linux/macOS: Use your package manager, e.g.:
      sudo apt install testdisk    # Ubuntu/Debian
      brew install testdisk        # macOS with Homebrew
      
  2. Run as Administrator/root for full drive access.
  3. Do not write to the drive you’re recovering data from. Always save recovered data to a different disk or partition.

🔧 Using TestDisk (Partition & File Recovery)

1. Launch TestDisk

Run from the terminal or double-click testdisk_win.exe.

2. Create or Use Log File

Choose:

  • [Create] a new log file (recommended),
  • [Append] to add to an existing log,
  • [No Log] if you don’t want a log.

3. Select Disk

Use the arrow keys to select the correct disk (e.g., /dev/sda or Disk /dev/sdb) and press Enter.

4. Partition Table Type

Usually auto-detected. Common options:

  • Intel/PC for MBR
  • EFI GPT for modern systems with GPT partitions

5. Choose Task

For partition recovery:

  • Select [Analyse] → Press Enter
  • It scans current partition structure
  • Choose [Quick Search] → Enter

You’ll see possible partitions. Press P to list files and see if it’s the one you want.

6. Recover Partitions

  • If the partition looks valid, press Enter
  • Press Write to save the partition structure
  • Confirm and reboot system if required

7. Undelete Files (Optional)

If your partition is readable:

  • Choose [Advanced]
  • Select partition → Choose [Undelete]
  • Navigate and press c to copy selected files

📸 Using PhotoRec (File Recovery)

1. Launch PhotoRec

Run photorec (or photorec_win.exe on Windows).

2. Select Disk

Choose the disk containing lost files, then press Enter.

3. Select Partition or Whole Disk

Choose:

  • The partition (e.g., for FAT/NTFS/exFAT/ext4)
  • Or choose “No partition” to scan whole disk

4. File System Type

  • Choose Other for FAT/NTFS/exFAT
  • Choose Ext2/Ext3 if using Linux filesystems

5. Choose Search Options

  • Choose Free to scan only free (unallocated) space
  • Choose Whole to scan entire partition for deeper recovery

6. Set Destination Folder

  • Select where recovered files will be saved
  • Make sure it’s on a different disk

7. Recovery Begins

PhotoRec will start recovering files. All found files are categorized by type and dumped into folders (recup_dir.*).


📁 After Recovery

  • Recovered files may have generic names, but you can preview them to sort.
  • Use tools like ExifTool (for photos) or file viewers to identify files.

🛑 Cautions

  • Don’t recover files to the same drive—they might overwrite recoverable data.
  • For disk images, consider cloning the drive with ddrescue first.

🧠 Tips

  • You can filter file types in PhotoRec via File Opt (press S to disable/enable extensions).
  • Combine with a GUI wrapper (like QPhotoRec) for easier use on Windows.

Leave a Reply

Your email address will not be published. Required fields are marked *