File Carving and Signature-Based Data Recovery
File carving finds files by recognising their content rather than by following file-system records. How well a carver detects signatures, parses formats, finds where a file ends and handles fragments decides what its results are worth. A recognisable header is not proof that a carved file is complete, correctly bounded or correctly named. The top-level comparison with metadata recovery is in File-System Recovery vs. File Carving; this page goes one level deeper.
- Pure carving does not rebuild file-system context such as paths and directory timestamps, but content can carry its own names and times.
- Where a file ends is decided by header sizes, footers, format parsing or the next header; the method shapes the result.
- General carving handles fragmentation poorly; format-aware fragment reconstruction exists for some formats, not for any file.
- Metadata recovery first is a common order, not a fixed rule; image-based parallel scans and the surviving structures can justify another.
- Format validation shows a file parses, not that it is complete, original or correctly dated; the number of supported formats is not a quality measure.
Detection: signatures are more than extensions
A carver scans raw data for recognisable structures, decides the probable format, estimates the file’s extent, extracts it and, ideally, checks it. A signature can be fixed magic bytes at the start or at an offset, a header structure, a footer, length fields or internal tables. PhotoRec’s custom signatures, for example, consist of an extension, an offset and a magic value; its documentation adds that controlling content checks, size and footer detection for a format means changing its source code. Two tools that both list an extension can therefore reconstruct it with very different reliability.
Where a carved file ends
After a header comes the harder question of where the file stops. Strategies include a size stored in the header, a footer marker, parsing internal structures to compute the real extent, a fixed size for the format, stopping at the next recognised header, or a heuristic. PhotoRec’s documentation says that for some formats it can determine the original size from the header, and that for others it stops appending data when a new file header is found; disabling too many file types therefore produces overlong files. Truncated and overlong results follow directly from the strategy used.
Fragments and their limits
The simplest model assumes a header, contiguous data and an end. Real files are often split, with unrelated data between their parts. General carving is weak here: without file-system mappings it has to infer which fragments belong together, and naive contiguous extraction joins a file’s first part to whatever follows it. Large files, such as video, archives, databases and mail stores, are more exposed than small ones.
That is a limit of general carving, not of every technique. Format-aware reconstruction can use length fields, internal pointers and decoding checks to find and order fragments for formats that carry such evidence. PhotoRec documents recovering some fragmented files in later passes and an optional, CPU-intensive brute-force mode for fragmented JPEG files. None of this extends automatically to arbitrary formats. For camera video in particular, see Recovering Fragmented Video from Memory Cards.
What carving does and does not know about the file system
Pure carving does not rebuild file-system context. PhotoRec’s documentation states that it does not recover original filenames or the file structure, and names output files by type and number. Paths, directory structure and file-system timestamps are not part of what a signature match finds.
The content, however, can carry its own metadata. A JPEG may include EXIF capture time and camera details; office documents, PDFs and archives can contain internal titles, author fields, member names and timestamps. Those survive carving because they are part of the bytes. Hybrid tools go further and combine carved results with whatever file-system evidence survives, which pure signature matching does not do. The term “carving” on a product page does not say which of these a tool performs.
Illustration: an internal time, a new name
A carved JPEG opens correctly, shows an EXIF capture time and has a generated name.
The internal time came with the content. The original path and file-system timestamps were not recovered by carving.
Report the internal time as embedded metadata, and look for file-system evidence separately if the path or dates matter.
A conceptual example. Embedded metadata can be absent, edited or wrong, and is not proof of when the file was stored.
Scan scope: unallocated space, partition or device
Where allocation information exists, a tool may limit carving to unallocated space: fewer duplicates of visible files, less noise and a faster scan. That depends on the allocation metadata being supported and trustworthy. If it is damaged or stale, scanning only what it calls free can miss data that is still there. PhotoRec offers a whole-partition search, which its documentation recommends when the file system is corrupted, or an unallocated-only search, in which only deleted files are recovered; it can also use block-size information from the file system. A whole partition and a whole physical device are different scopes again: the device includes unpartitioned space and other partitions. These are PhotoRec’s modes; other tools define their scopes differently.
Metadata recovery first is a reasonable default when file-system structures survive, because it gives names, paths and extents. It is not a fixed ladder. A carving scan can run in parallel against the same image, the target format may be one that carves well, and when metadata is clearly destroyed there is little reason to wait. What matters is working from a preserved image, not the failing source; see Metadata Recovery vs. Raw Recovery.
What a carved result should record
A carved file is only useful as evidence if its origin is kept with it:
- the source and the offset or range it was carved from;
- how it was detected and how its end was determined;
- whether it is complete, truncated or partial;
- its validation status;
- duplicates, and whether it was found inside another file.
Embedded items need care. Thumbnails, previews and files embedded in documents or archives can be carved as separate results; a thumbnail is not the full-size original, and an embedded copy is not an independent original file.
Validation and its limits
A byte sequence that resembles a header is not a valid file, so serious carvers check their output: footers, internal lengths, checksums, whether a parser accepts the file, whether an image decodes, whether an archive tests clean. PhotoRec verifies recovered files and rejects invalid ones by default, and can be told to keep corrupted files. These checks show that a file is structurally plausible. They do not show that it is the original version, that it is complete in meaning, or when it was created, unless there is a trusted reference to compare it with. See How to Validate Recovered Data.
What carving cannot do
A signature match is evidence that recognisable bytes are still present. Carving cannot bring back bytes that were overwritten, deallocated by TRIM and then actually erased, or never recovered from a failing device. Encrypted content exposes no plaintext signatures, so the encryption layer has to be unlocked or reconstructed before carving means anything; see Encryption Key Hierarchies and Recovery Metadata. Compression, deduplication, RAID and virtual storage likewise need the logical address space rebuilt first.
Questions for comparing carvers
A single “carving: yes/no” row hides most of what differs. Useful questions are whether the tool offers metadata recovery, signature carving, hybrid recovery or format-specific fragment reconstruction; whether signatures can be added; whether offsets, footers and internal sizes are used; whether output is format-validated; how fragments are handled; which scan scopes exist and whether allocation information can constrain them; whether results record offsets and status; and whether a scan can run against an image and be saved or resumed. The number of supported formats answers none of these.
Signature recovery is not file-system reconstruction: a carved file and a metadata-recovered file can share a payload but carry different context. A longer format list is not better recovery: parsing and validation quality is what matters. Carving finds bytes that are still present: it cannot restore overwritten or inaccessible data.
Technical references: CGSecurity: PhotoRec documentation — no original names, size from header, next-header stop, scan scope, Paranoid and brute-force options · CGSecurity: PhotoRec — works on damaged file systems, block size, fragmentation · CGSecurity: Custom signatures — extension, offset, magic. Pages checked October 2026; PhotoRec options can change between versions, and other carvers behave differently.
Related: File-System Recovery vs. File Carving · Metadata Recovery vs. Raw Recovery · How to Validate Recovered Data · Recovering Fragmented Video from Memory Cards · TRIM, Deallocate and Garbage Collection · Media Recovery, File Repair and Content Validation