Glossary Forensics

File carving

File carving is recovering files from raw storage by searching for their start and end signatures, without relying on the file system's directory records.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page

In more detail

When a file is deleted, its data often stays on disk until overwritten even though the file system no longer lists it. Carving tools scan for Magic bytes such as FF D8 FF (JPEG) and read onward to the end marker. Fragmented files are harder to carve, and recovered files have lost their names and timestamps. Formats without an end marker are cut using a size field in their header or a maximum length, and carvers validate each hit (for example by checking that a JPEG decodes) to discard false starts that occur by chance in random data.

Why it matters

Carving recovers photos from formatted memory cards, documents from unallocated disk space and files embedded inside other files, such as an image hidden in a PDF or a payload appended to an installer. On SSDs, TRIM often erases freed blocks quickly, so less can be carved than on hard drives, and encrypted volumes yield nothing without the key.

Example

An 8,639-byte test blob made for this page holds random filler, a JPEG and a PNG. Searching for signatures:

FF D8 FF  found at offset 4096 (0x1000), FF D9 end at 4987  -> 891-byte JPEG
89 50 4E 47 0D 0A 1A 0A at 7987 (0x1F33), IEND AE 42 60 82 ends at 8127 -> 140-byte PNG

Both carved files are byte-for-byte identical to the originals. The Binary & Archive Forensics lists embedded signatures like these.

AdSense Placeholder
Slot: footer_leaderboard