PhotoRec

PhotoRec is a powerful, completely free, open-source file carving and data recovery software designed to retrieve lost files from various storage devices, including hard drives, SSDs, USB flash drives, memory cards, and digital camera storage. Developed by Christophe Grenier as a companion tool to TestDisk, PhotoRec has been one of the most trusted and widely used data recovery tools since its initial release, particularly for recovering multimedia files from corrupted or formatted media.

Unlike traditional data recovery software that relies on the file system to locate and recover files, PhotoRec uses a fundamentally different approach called “file carving.” It ignores the file system entirely and reads data sector by sector, searching for unique file signatures (headers and footers) that identify specific file types. This makes PhotoRec exceptionally effective when the file system is severely damaged, formatted, repartitioned, or completely missing.

PhotoRec works with storage devices of all capacities and supports virtually every operating system, including Windows, macOS, Linux, FreeBSD, NetBSD, OpenBSD, SunOS, and DOS. It can recover over 480 different file types, including photos, videos, documents, archives, emails, and many proprietary formats. The software is distributed under the GNU General Public License, making it completely free with no limitations on recovery amount, no premium upgrades, and no hidden costs.


What is PhotoRec?

PhotoRec stands for “Photo Recovery” but its capabilities extend far beyond photographs. The software was originally designed to recover lost pictures from digital camera memory cards, but has since evolved to support hundreds of file types across multiple categories.

The key principle behind PhotoRec is file carving – recovering files based on their content rather than their directory entries. When a file is deleted or a drive is formatted, the file system metadata (filenames, folder structures, timestamps) is often destroyed, but the actual file content may remain on the storage media until overwritten. PhotoRec scans the drive sector by sector, identifies patterns that match known file signatures, and reconstructs the files by extracting the data between the header and footer signatures.


Key Features of PhotoRec

Here are the key features typically associated with PhotoRec:

Comprehensive Device Support

  • Storage Devices: Supports HDD, SSD, USB flash drive, memory card (SD, microSD, CompactFlash), external hard drive, digital camera, and more.
  • Optical Media: Can recover from CDs and DVDs.
  • Disk Interfaces: Compatible with all standard interfaces including IDE, SATA, SCSI, and USB.
  • File Systems: Works regardless of file system – can recover from FAT, exFAT, NTFS, HFS+, APFS, Ext2/3/4, UFS, XFS, and many others.

Over 480 Supported File Types

PhotoRec can recover a vast range of file types, including:

  • Images: JPG, PNG, GIF, BMP, TIFF, RAW formats (CR2, NEF, ARW, DNG, ORF, PEF, SR2, RAF), PSD, HEIC, WebP, ICO, PCX, TGA, XPM.
  • Documents: DOC, DOCX, XLS, XLSX, PPT, PPTX, PDF, RTF, ODT, ODS, ODP, TXT, HTML, XML, WPD, PUB, PAGES, NUMBERS, KEY, ABW, ZABW.
  • Audio: MP3, WAV, WMA, OGG, FLAC, M4A, AAC, AIFF, AU, RA, RM, AC3, DTS, MID, MIDI.
  • Video: AVI, MOV, MP4, MPG, MPEG, WMV, ASF, MKV, FLV, 3GP, M4V, MTS, M2TS, VOB, RMVB, OGV, WEBM.
  • Archives: ZIP, RAR, 7Z, TAR, GZ, BZ2, XZ, CAB, ISO, DMG, CPIO, AR, LHA, LZH.
  • Email & Databases: PST, OST, DBX, EML, MBOX, MBX, NSF, MDB, ACCDB, SQLITE, FDB, GDB.
  • Executables: EXE, DLL, SYS, DRV, OCX, COM, BAT, CMD, MSI, APK, APP, DMG, PKG, DEB, RPM.

Custom File Signature Addition

For advanced users and forensic analysts, PhotoRec allows adding custom file signatures to recover proprietary or less common file types. You can define the header, footer, and other characteristics of any file format, and PhotoRec will recognize and recover those files during scanning.

Metadata Preservation

When possible, PhotoRec preserves important metadata:

  • EXIF Data: In JPEG files, camera settings, date/time, and GPS coordinates are preserved.
  • File Timestamps: Date and time stamps are recovered when available in the file system fragments.
  • Embedded Information: Author information, comments, and other embedded metadata.

Raw Recovery Mode

PhotoRec’s primary operating mode is raw recovery – it ignores the file system entirely and reads the drive sector by sector. This makes it effective even when:

  • The drive has been formatted or reformatted multiple times.
  • The partition table is missing or corrupted.
  • The drive appears as RAW in the operating system.
  • The file system is completely destroyed.
  • The drive has been repartitioned.

Selective File Type Recovery

Users can choose to recover all file types or selectively recover only specific file types. This can significantly speed up the recovery process and reduce the number of irrelevant files to sort through. For example, if you only need to recover photos, you can select only image file types.

Whole Disk or Unallocated Space Scanning

PhotoRec offers two scanning options:

  • Whole Disk/Partition: Scans the entire selected partition, including areas that currently contain active file system data.
  • Unallocated Space Only: Scans only the unallocated space (free space) of a partition, ignoring areas currently occupied by existing files.

Recovery from Disk Images

PhotoRec can work directly on disk images (created with dd, TestDisk, or other imaging tools). This is particularly useful when the source drive is failing – you can create a disk image first, then run PhotoRec on the image to avoid further stressing the original hardware.


How to Use PhotoRec

PhotoRec is a command-line tool, but it includes an interactive text-based interface that guides users through the recovery process. Follow these steps to recover your lost files:

  1. Download and Extract – Download the TestDisk package (which includes PhotoRec) from the official website. Extract the archive to a folder on a different drive than the one you want to recover from.
  2. Run PhotoRec
    • Windows: Run photorec_win.exe as Administrator.
    • macOS: Run photorec from the command line (requires sudo).
    • Linux: Run sudo photorec from the terminal.
  3. Select the Disk – Use arrow keys to select the disk containing the lost files, then press Enter.
  4. Select Partition – Choose the specific partition to scan, or select [Whole disk] to scan the entire drive including partition table areas. Use arrow keys to select and press Enter.
  5. Select File System Type – Choose the file system type of the partition. PhotoRec typically auto-detects this correctly. Options include ext2/ext3/ext4, FAT, NTFS, HFS+, and others. Accept the default selection unless you know you need a different type.
  6. Select Scan Area – Choose between:
    • [Whole] – Scan the entire partition (recommended for formatted or corrupted drives).
    • [Free] – Scan only unallocated space (faster, for simple deletions on healthy drives).
  7. Select Destination Folder – Navigate to a folder on a different drive where recovered files will be saved. Important: Do not save to the same drive you are recovering from.
  8. Select File Types – Choose which file types to recover:
    • [All] – Recover all supported file types (default).
    • [FileOpt] – Select specific file types to recover (use space bar to select/deselect).
  9. Start Recovery – Press Y to begin scanning and recovery. The process may take minutes to hours depending on drive size and speed.
  10. Browse Recovered Files – After completion, recovered files are saved in directories named recup_dir.1, recup_dir.2, etc. Files are renamed with generic names like “f1234567.jpg” and organized by type in the directory where the recovery occurred.

Understanding PhotoRec Recovery Output

When PhotoRec completes a recovery, the output follows a specific structure:

  • Directory Names: recup_dir.1, recup_dir.2, recup_dir.3, etc. – each directory contains recovered files from different parts of the scan.
  • File Names: Generic names like f0012345.jpg, f0012346.mp3, f0012347.pdf – the number indicates the sector offset where the file was found.
  • File Organization: Files are NOT organized by original folder structure because PhotoRec ignores the file system. All recovered files are placed in the same directory level.
  • Duplicate Files: PhotoRec may recover the same file multiple times if it finds overlapping signatures.
  • Partially Overwritten Files: Some recovered files may be incomplete if the original data was partially overwritten.

System Requirements

PhotoRec has minimal system requirements, making it suitable for older hardware and bootable recovery environments:

  • Processor: Any x86, x86-64, ARM, or PowerPC processor
  • RAM: Minimal (less than 64MB)
  • Hard Disk Space: Approximately 10-15MB for the executable files, plus space for recovered files
  • Supported Operating Systems:
    • Windows 10, 8, 7, Vista, XP, 2000, NT, Me, 98, 95
    • macOS (Intel and Apple Silicon)
    • Linux (all major distributions)
    • FreeBSD, NetBSD, OpenBSD, DragonFly BSD
    • SunOS / Solaris
    • DOS
  • Permissions: Administrator/root access required on Windows and Unix-like systems for direct disk access

Known Limitations

While PhotoRec is incredibly powerful, users should be aware of the following limitations:

  • No Original File Names: Because PhotoRec ignores the file system, recovered files lose their original filenames and are renamed with generic names (f1234567.jpg). You cannot recover the original folder structure.
  • No File Preview: Unlike commercial tools, PhotoRec does not offer file preview before recovery. You cannot verify file contents before recovering.
  • Command-Line Interface: PhotoRec has a text-based interface, not a graphical user interface (GUI). This can be intimidating for beginners, though the interface is interactive and menu-driven.
  • Duplicate Recoveries: PhotoRec may recover the same file multiple times if it finds overlapping or redundant signatures, requiring manual deduplication.
  • Partially Overwritten Files: If the original file data has been partially overwritten, PhotoRec may still recover a file, but it will be incomplete or corrupted.
  • Small File Overwrite Risk: Very small files may be completely overwritten before PhotoRec can recover them, especially on active drives.
  • TRIM on SSDs: On modern SSDs with TRIM enabled, deleted files may be permanently erased almost immediately, making recovery impossible.
  • Physical Damage Not Covered: Cannot recover data from physically damaged drives (clicking, grinding, water damage). Hardware repair is required first.
  • No Secure Deletion: PhotoRec does not include secure deletion/wiping features.
  • Time-Consuming on Large Drives: Scanning a 2TB drive can take many hours or even days, depending on the drive speed and interface.

Comparison at a Glance

FeaturePhotoRecTypical Commercial Competitors
PriceFree (open-source)$50-$150
Recovery MethodFile carving (signature-based)File system + file carving
Preserves File NamesNoOften yes (when possible)
Preserves Folder StructureNoOften yes (when possible)
File PreviewNoYes
Graphical InterfaceText-basedModern GUI
File Types Supported480+ typesVaries (often 200-400)
Custom File SignaturesYes (advanced users)Sometimes available
Platforms SupportedWindows, Mac, Linux, BSD, Solaris, DOSOften Windows only

Common Scenarios Where PhotoRec Excels

  • Formatted Memory Cards: After accidentally formatting a digital camera SD card, PhotoRec can recover photos and videos regardless of the new file system.
  • Repartitioned Drives: When a drive has been repartitioned or the partition table has been overwritten, PhotoRec can still recover files.
  • RAW or Unreadable Drives: When a drive appears as RAW or shows “Not Formatted,” PhotoRec can extract files without needing a valid file system.
  • Corrupted File Systems: When file system corruption prevents normal access, PhotoRec’s signature-based approach bypasses the damage.
  • Virus or Ransomware Damage: When viruses destroy file system structures, PhotoRec can often recover the underlying data.
  • Quick Format Recovery: After a quick format where the file system was reinitialized, PhotoRec can recover most files.
  • Digital Camera Recovery: Recovering photos from memory cards that were accidentally formatted or corrupted during shooting.

Final Verdict: Is PhotoRec Right for You?

PhotoRec is one of the most powerful and widely used file carving tools available. Its completely free nature, extensive file type support, and ability to recover from severely damaged or formatted drives make it an essential tool in any data recovery toolkit. While it lacks the user-friendly interface and features of commercial software, its raw recovery power is unmatched.

This software is ideal for:

  • Digital Photographers: Recovering photos from formatted or corrupted memory cards.
  • Forensic Analysts: File carving is a standard technique in digital forensics, and PhotoRec is a trusted tool in the field.
  • IT Professionals: When file systems are destroyed beyond recognition, PhotoRec can still recover data.
  • Budget-Conscious Users: Completely free with no limitations – the most powerful free recovery tool available.
  • Advanced Users: Users comfortable with text-based interfaces will appreciate the control and flexibility.
  • Recovery from Formatted Drives: When a drive has been formatted and other tools fail, PhotoRec often succeeds.

Consider alternatives if:

  • You need to preserve original filenames and folder structures (PhotoRec does not preserve either).
  • You need file preview before recovery to verify contents.
  • You want a graphical user interface with point-and-click operations.
  • You are uncomfortable with text-based, menu-driven interfaces.
  • Your drive is physically damaged – professional hardware repair services are required regardless of software.
  • You need to recover from encrypted drives without the decryption key.
  • You have very small files that may be completely overwritten – file carving works best on larger files.

Pro Tip: After data loss, stop using the affected drive immediately. Do not add new files, run disk repair tools, or attempt to format the drive. For best results with PhotoRec, always save recovered files to a different drive. If the drive is failing or has bad sectors, create a disk image first using dd or TestDisk, then run PhotoRec on the image. This protects the original hardware from further damage. After recovery, be prepared to manually sort through recovered files – since original names are lost, you will need to preview each file to identify its contents.


Disclaimer: Recovery success depends on multiple factors, including how long ago data was lost, whether the drive has been used since the loss, and the extent of fragmentation or overwriting. No data recovery software can guarantee 100% recovery in all situations. This article is for informational purposes only. All product names, logos, and brands are property of their respective owners.

“`

Leave a Comment

Scroll to Top