Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 36 ยท Disk and File System Forensics

File Systems: FAT, NTFS and ext4

Compare the major file systems an examiner meets (FAT32, exFAT, NTFS, ext4, APFS), learn clusters, allocation tables and journals, and parse a FAT boot sector and cluster chain.

A file system is the set of structures that turns a pile of sectors into named files and folders. It decides where file data lives, how names map to data, what metadata is kept (timestamps, permissions, owner) and what happens when a file is deleted. Because those choices differ, so does the evidence: NTFS records more timestamps than FAT, ext4 keeps a journal, APFS supports snapshots. Learn the vocabulary once, and every file system becomes an easier variation.

Common vocabulary

  • Sector: the disk's smallest unit (512 B or 4 KiB). Cluster (or block): a group of sectors that the file system allocates as one unit, often 4 KiB.
  • Metadata: information about a file stored in a directory entry, an inode or an MFT record, not in the file's content.
  • Allocation: which clusters belong to which file, and which are free.
  • Journal: a log of changes about to be made, so the file system can recover after a crash. It can also preserve older metadata.
  • Slack space: the unused bytes at the end of a file's last cluster (more here).
File system Typical use Notable forensic points
FAT12/16/32 USB sticks, SD cards, old systems Simple allocation table; timestamps with 2-second resolution; no permissions; file names survive deletion except the first character
exFAT Large flash media, cameras Allocation bitmap; supports files above 4 GiB
NTFS Windows Master File Table, alternate data streams, journal ($LogFile, $UsnJrnl), many timestamps (next lessons)
ext2/3/4 Linux Inodes, group descriptors, journal (ext3/4), deleted inodes zeroed on ext4 more often
APFS macOS, iOS Copy-on-write, snapshots, native encryption, clones
HFS+ Older macOS Catalog file, journal
ReFS, XFS, Btrfs, ZFS Servers Snapshots and copy-on-write change what survives

How FAT works

FAT (File Allocation Table) is the simplest, so it is the best teaching example. A FAT volume has:

  1. A boot sector (BPB, BIOS Parameter Block) describing the layout.
  2. One or two copies of the File Allocation Table: an array with one entry per cluster. An entry holds the number of the next cluster of the file, or an end-of-chain marker, or 0 if the cluster is free.
  3. The data region, starting with the root directory in FAT12/16 (a fixed area) or at a cluster in FAT32.
  4. Directory entries of 32 bytes each: name, attributes, timestamps, first cluster and size.

Reading a file means: start at the first cluster from the directory entry, then follow the FAT chain to the next cluster until the end marker.

Python Parse the FAT32 boot sector

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last line is the central FAT formula: cluster numbering starts at 2, so the sector of cluster n is data_start + (n โˆ’ 2) ร— sectors_per_cluster.

Following a cluster chain

Next, a tiny FAT: a file stored in clusters 5, 6 and 9, and a second file in clusters 7 and 8. The FAT shows the links.

Python Reconstruct a file from the FAT

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the file does not need to be contiguous: a.txt jumps from 6 to 9. This fragmentation is normal, and carving tools struggle with it.

NTFS in one page

NTFS stores everything, even its own structures, as files whose names start with $. The most important is the Master File Table ($MFT): one record (usually 1,024 bytes) per file or folder, containing a list of attributes. Two attributes matter most: $STANDARD_INFORMATION (timestamps, flags) and $FILE_NAME (name, parent, its own timestamps), and $DATA (the content, or a list of runs pointing to clusters; very small files live directly inside the MFT record). NTFS also has alternate data streams, named extra $DATA attributes attached to a file, which can hide content from simple directory listings, plus a change journal ($UsnJrnl) and a transaction log ($LogFile). We study timestamps in their own lesson.

ext4 and APFS in brief

ext4 divides the disk into block groups, each with bitmaps and an inode table. An inode stores permissions, owner, timestamps (modification, change, access and creation, crtime), and extents (ranges of blocks). File names live in directory blocks that map name to inode number. The journal can hold copies of recent metadata, and deletion typically clears the extents of the inode, making recovery harder than on FAT.

APFS is copy-on-write: edits are written to new blocks and old versions can remain referenced by snapshots. It supports per-volume encryption and cloning, so one logical file may share blocks with another. Time Machine and iOS updates create snapshots that examiners can mine for earlier states.

Which file system is this?

You can often tell from a few bytes at the start of a partition. NTFS volumes show the string NTFS at offset 3; FAT32 shows FAT32 at offset 82; exFAT shows EXFAT at offset 3; ext2/3/4 have the magic 0xEF53 at offset 1080 (56 bytes into the superblock, which begins at byte 1024).

Python Identify a file system from its signature

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In FAT, what does an entry in the allocation table hold?

    The FAT is an array of cluster links; following them reconstructs a file's data.
  2. 2. Which sector holds cluster 2 in a FAT32 volume?

    Cluster numbering starts at 2 and the data region begins with cluster 2.
  3. 3. What is the Master File Table in NTFS?

    The $MFT holds a record for every file with attributes such as names, timestamps and data runs.
  4. 4. Which file system uses copy-on-write and snapshots by default on modern Apple devices?

    APFS is copy-on-write and supports snapshots, which can preserve earlier file states.

Summary

  • A file system maps names to data and keeps metadata; each type leaves different evidence.
  • FAT uses a boot sector, a cluster-link table, directory entries and a data region starting at cluster 2.
  • NTFS keeps everything in the Master File Table, plus streams, journals and several timestamps.
  • ext4 uses inodes, block groups and a journal; APFS uses copy-on-write and snapshots.
  • File-system signatures (offsets 3, 82, 1080) quickly identify a volume.

Next: File signatures and file carving