Digital Forensic Tools

SQLite WAL files and deleted records

Short answer

A SQLite WAL file holds recent changes before they are merged into the main database. Deleted records can also stay inside the database file. Both can contain evidence that a normal viewer does not show.

What the WAL is

WAL means write-ahead log. In this mode SQLite adds changes to a separate file with a -wal ending instead of changing the main file straight away. A -shm file helps readers find pages quickly. Later a checkpoint copies the changes back into the main database.

Why it matters for evidence

If a phone is stopped before a checkpoint, new records may exist only in the -wal file. If you copy only the main file, you lose them. If you open the database in a normal tool, the tool may run a checkpoint and change the files. So copy the database, the -wal and the -shm together, and work on a copy.

  • Keep the files together.
  • Hash them before you work.
  • Prefer tools that read the files without merging them.

Deleted records

When a row is deleted, SQLite often does not erase it at once. Pages that are no longer used go on a freelist. Space inside a page can also hold left-over cell data. This data stays until it is reused. Recovery is not certain. Vacuum operations and later writes can remove it.

Example

A practice chat database is copied with its -wal file. Opened alone, the main file shows 100 messages. With the WAL read as well, 12 newer messages appear. The student notes both counts, hashes the files and works only on copies.

Common mistakes

  • Copying only the .db file and leaving out the -wal file.
  • Opening the original in a tool that checkpoints the log.
  • Assuming deleted rows can always be recovered.
  • Treating recovered fragments as complete records.
  • Forgetting that a vacuum can remove old data.

Key terms

WAL
Write-ahead log, a file that holds recent changes before they are merged.
Checkpoint
The step that copies WAL changes into the main database.
Freelist
A list of database pages that are not currently in use.
Carving
Recovering data by looking for its structure in raw bytes.

Questions you may be asked

What is a WAL file and why does it matter?

It holds recent changes not yet merged into the main database, so it may contain records that exist nowhere else.

Why can deleted SQLite data sometimes be recovered?

The engine often leaves deleted data in freelist pages or unused space until it is overwritten.

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.