Recovers deleted files from disk images and storage media using PhotoRec's file signature-based carving engine, which works regardless of file system damage or corruption. Use when recovering deleted or lost files from a forensic disk image, damaged storage device, or corrupted file system during evidence recovery.
Recovers deleted files from disk images and storage media using PhotoRec's file signature-based carving engine, which works regardless of file system damage or corruption. Use when recovering deleted or lost files from a forensic disk image, damaged storage device, or corrupted file system during evidence recovery.
When recovering deleted files from a forensic disk image or storage device
When the file system is corrupted, formatted, or overwritten
During investigations requiring recovery of documents, images, videos, or databases
When file system metadata is unavailable but raw data sectors remain intact
For recovering files from memory cards, USB drives, and hard drives
Prerequisites
PhotoRec installed (part of TestDisk suite)
Forensic disk image or direct device access (read-only)
Sufficient output storage space (potentially larger than source)
Write-blocker if working with original media
Root/sudo privileges for device access
Knowledge of target file types for focused recovery
Workflow
Step 1: Install PhotoRec and Prepare the Environment
# Install TestDisk (includes PhotoRec) on Debian/Ubuntusudo apt-get install testdisk
# On RHEL/CentOSsudo yum install testdisk
# On macOS
brew install testdisk
# Verify installation
photorec --version
# Create output directory structuremkdir -p /cases/case-2024-001/recovered/{all,documents,images,databases}
# Verify the forensic image
file /cases/case-2024-001/images/evidence.dd
ls -lh /cases/case-2024-001/images/evidence.dd
Step 2: Run PhotoRec in Interactive Mode
# Launch PhotoRec against a forensic image
photorec /cases/case-2024-001/images/evidence.dd
# Interactive menu steps:# 1. Select the disk image: evidence.dd# 2. Select partition table type: [Intel] for MBR, [EFI GPT] for GPT# 3. Select partition to scan (or "No partition" for whole disk)# 4. Select filesystem type: [ext2/ext3/ext4] or [Other] for NTFS/FAT# 5. Choose scan scope: [Free] (unallocated only) or [Whole] (entire partition)# 6. Select output directory: /cases/case-2024-001/recovered/all/# 7. Press C to confirm and begin recovery
photorec /dev/sdb
# For direct device scanning (with write-blocker)
sudo
Step 3: Run PhotoRec with Command-Line Options for Targeted Recovery
Alternative file carver originally developed by US Air Force OSI
Scalpel
High-performance file carver based on Foremost
hashdeep
Recursive hash computation and audit tool
jpeginfo
JPEG file integrity verification
file
Unix utility identifying file types by magic bytes
exiftool
Extract metadata from recovered image and document files
Common Scenarios
Scenario 1: Recovering Deleted Evidence from a Suspect's USB Drive
Image the USB drive with dcfldd, run PhotoRec targeting document and image formats, organize by file type, hash all recovered files, compare against known-bad hash sets, extract metadata from images for GPS and timestamp information.
Scenario 2: Formatted Hard Drive Recovery
Run PhotoRec in "Whole" mode against the entire formatted partition, recover all file types, expect higher false positive rate due to file fragmentation, validate recovered files with signature checking, catalog and hash for evidence chain.
Scenario 3: Memory Card from a Surveillance Camera
Recover deleted video files (AVI, MP4, MOV) from the memory card image, use targeted file type selection to speed recovery, verify video files are playable, extract frame timestamps, document recovery in case notes.
Scenario 4: Corrupted File System on Evidence Drive
When file system metadata is destroyed, PhotoRec bypasses the file system entirely and carves from raw sectors, recover maximum possible data, accept that file names and directory structure will be lost, rename files based on content during review.