Digital Forensic Tools

What is file carving?

Short answer

File carving recovers files from raw data by looking for their content patterns, such as the start and end markers, instead of using file system records.

How carving works

Many file types begin with a fixed byte pattern called a header, or magic number. Some also end with a footer. A carver scans the raw data, finds a header, and copies the bytes up to the footer or a size limit.

Carving is used when directory entries are missing or damaged, for example after deletion, formatting or a corrupted file system. The same idea is used on memory dumps.

Limits

Most carvers expect the file to be stored in one piece. Fragmented files, whose parts sit in different places, may come out broken or incomplete. Studies by Garfinkel found that a fair share of JPEG and Word files are fragmented.

Carved files have no name, no folder and no original times. Output can include false hits, so check each file. Carving from a forensic image is safer than from the original drive.

Better methods

Basic header and footer carving is the simplest. Other methods use a maximum size, a length stored in the file, or checks of the file structure to confirm the result. Some tools can join fragments by testing which pieces fit together.

Always record the tool, the version and the signature set you used, so another examiner can repeat the result.

Carving and file system recovery

File carvingFile system recovery
UsesFile content patternsFile system records
Names and timesUsually lostOften kept
Works on formatted drivesOften yesOnly if records remain
Fragmented filesWeakBetter

Example

A memory card was formatted before it reached the lab. The file system shows no files. The examiner runs a carver on the image and recovers JPEG photos by their header and footer. The photos have generic names, so the examiner checks the embedded metadata for dates.

Common mistakes

  • Expecting carved files to have names and original times.
  • Trusting every carved file without opening and checking it.
  • Carving from the original drive instead of an image.
  • Using only the default signatures and missing unusual file types.

Key terms

Header
The first bytes of a file that show its type.
Footer
Bytes that mark the end of some file types.
Magic number
Another name for a file signature at the start of a file.
Fragmentation
A file stored in several separate pieces.

Questions you may be asked

Why does carving work when the file system is damaged?

It reads the raw bytes and recognises file types by their own structure, so it does not need directory entries.

Why are fragmented files hard to carve?

The carver expects the data to follow the header in one block, so pieces stored elsewhere are missed.

Free tools to practise with

Learn more

Written in our own words from public forensic training material and standards. Last reviewed 24 Nov 2026. Procedures and laws differ by country and agency. Follow your own lab's procedure.