← Back to CGSecurity

PhotoRec

Maker: CGSecurity (Christophe Grenier) Runs on: Windows, macOS, Linux, BSD, Solaris, DOS

PhotoRec ships alongside TestDisk from the same download, but it is a separate utility and a file carver, not a filesystem-recovery tool: it reconstructs files from content patterns when filesystem metadata is absent, damaged, or deliberately set aside.

Recovery scenarios

PhotoRec is used when filesystem metadata can no longer be trusted to describe the files: deleted files whose records are gone, formatted or re-partitioned media, damaged or unrecognized filesystems, and memory cards from cameras and other devices. It can carve a whole partition or, on supported filesystems, only the unallocated space. Partition repair and metadata undelete are not PhotoRec's job; they belong to TestDisk, the separate utility distributed with it.

Scan and recovery methods

PhotoRec's core recovery method is signature and content-based carving — scanning raw data for the internal patterns that identify a file type. Per CGSecurity's own documentation, it recognizes more than 300 file families and roughly 480 file extensions. For some formats it validates the file header or internal structure before accepting a match, and it includes extra logic to reassemble some fragmented JPEGs that a simple carver would miss. A "Keep corrupted files" option preserves partial or failed matches for later, format-aware salvage instead of discarding them outright.

When a format is not recognized out of the box, PhotoRec supports user-defined custom signatures in a photorec.sig file, with an extension, an offset and a text or hexadecimal magic value for each rule. That is its clearest advantage for proprietary or device-specific formats. See File Carving and Signature Recovery for how signature rules, size determination and false positives work in general.

File system support

PhotoRec does not depend on filesystem namespace metadata to reconstruct files, but "ignores the file system entirely" is too strong. It can use limited filesystem information, such as block size and offset, to decide where and how to carve, and on FAT, NTFS and Ext-family filesystems it can restrict the search to unallocated space. That use of partition and filesystem geometry guides the scan; it is a different thing from reading original names and folders back from filesystem records, which carving does not do. See File-System Recovery vs. File Carving for the full distinction.

Disk imaging and virtual disks

PhotoRec can carve from a disk image as well as from a device, which is the safer pattern when the source is in any doubt. It does not create images itself; CGSecurity recommends an image-first workflow with a dedicated imaging tool such as ddrescue before working on damaged media.

Source handling and write operations

PhotoRec's model is copy-out: analysing the source does not repair its filesystem in place, and recovered files are written to a directory the user chooses. CGSecurity explicitly warns not to store recovered files on the source filesystem, so that destination should be on a different physical drive; PhotoRec does not make an unsafe destination impossible. Writes by the host operating system, such as automatic mounting or repair prompts, are a separate risk, and PhotoRec is not a write blocker.

License

PhotoRec

Free

File carving: scans underlying data for recognizable file structures rather than depending on file-system metadata. That lets it work on damaged or reformatted file systems, but the original namespace is not reconstructed: paths are lost, and filenames come back generic except where a format's own internal metadata supplies one.

  • LicenseGNU GPL v2+ — free, open-source
  • InterfacePhotoRec text interface; QPhotoRec graphical front end is included in supported builds
  • Current version7.2 (February 2024), distributed together with TestDisk
$0Free and open-source, always
View on cgsecurity.org →

PhotoRec is free and open source under the GNU GPL v2+, with no recovery-size limit and no paid edition.

Limitations

  • Original names and folders: carving does not recover the namespace, so recovered files come back with generic, numbered names grouped by recovery run. For some formats PhotoRec builds a name from fields inside the file itself — per CGSecurity's release notes, an Office document's title, a PDF's title or the first filename inside a ZIP archive. That name comes from the content and can differ entirely from the name the file had in its directory.
  • Fragmentation: a file whose data isn't stored in one contiguous run can defeat signature-based reassembly even when every byte is still on the disk. How far PhotoRec gets depends on the format: consistency checks and the JPEG option help for some formats, not for all. See Fragmented & Memory-Card Recovery for how that plays out on flash media — also covered from the case side in Video & Memory Card Recovery — and Recovered Files Won't Open if carved files look present but won't open cleanly.
  • Interface: the text interface asks more of the user than a graphical wizard; QPhotoRec is a graphical front end in supported builds.
When this is the right tool

PhotoRec is especially useful when file-system metadata is unavailable or unreliable, or when a signature-based search is deliberately preferred — the ext3/ext4 undelete gap on TestDisk is a good example. It can also complement file-system-aware recovery rather than serving only as a last resort, but the loss of original names and directory structure is a real tradeoff. Once files are back, Validating Recovered Data covers how to confirm a carved file is actually intact before you rely on it.

Sources

Features verified: November 2026.