What is the FAT File System and How Does It Work?
Learn how the FAT file system works — cluster chains, directory entries, and reliability limits — with OS interview questions answered.
Expected Interview Answer
FAT (File Allocation Table) is a simple, flat file system that tracks which disk clusters belong to a file using a single shared table of linked-list-style entries, making it lightweight and universally compatible but weak on reliability, permissions, and large-volume support.
A FAT volume is divided into fixed-size clusters, and the File Allocation Table itself is an array with one entry per cluster: each entry either marks the cluster as free, marks it as the end of a file's chain, or holds the number of the next cluster in that file's chain, effectively forming a singly linked list per file. A directory entry stores the file name, size, attributes, and the index of the first cluster; the OS then walks the FAT chain cluster by cluster to read the rest. Because the table is usually duplicated for redundancy but has no journal, an interrupted write (like a sudden power loss) can leave the FAT and actual cluster usage inconsistent, requiring a full scan (chkdsk/scandisk) to repair. FAT also lacks POSIX permissions, hard links, and journaling, and variants (FAT12/16/32, exFAT) exist mainly to raise the maximum volume and file size limits FAT12/16 originally imposed.
- Extremely simple structure, easy to implement on constrained devices
- Near-universal compatibility across OSes, cameras, and USB drives
- Low overhead, suitable for small removable media
- Good baseline for understanding linked allocation and its failure modes
AI Mentor Explanation
FAT is like a scoring system where a single master ledger lists, cluster by cluster, which over belongs to which innings and which over comes next in that innings' sequence, with a marker for the last over bowled. To read an entire innings, the scorer starts at the first listed over and follows the “next over” pointers written in the ledger until reaching the end marker. If the ledger gets corrupted mid-match — say a page is torn during a rain delay — the whole scorebook needs re-checking over by over to figure out which overs actually belong where.
Step-by-Step Explanation
Step 1
Directory lookup
The OS reads the directory entry for the file name, getting its size, attributes, and first cluster number.
Step 2
First cluster read
The OS reads the data in that first cluster.
Step 3
FAT chain walk
The OS looks up that cluster's entry in the File Allocation Table to find the next cluster in the chain, repeating until an end-of-chain marker is found.
Step 4
End of file
When the FAT entry signals end-of-chain, the OS knows it has read the complete file.
What Interviewer Expects
- Understanding that FAT is a shared table forming a linked list of clusters per file
- Knowledge that the directory entry only stores the first cluster
- Awareness of FAT's reliability weakness (no journaling, requires chkdsk-style repair)
- Awareness that FAT lacks POSIX permissions and hard links
Common Mistakes
- Confusing the File Allocation Table with an inode table (FAT has no per-file metadata beyond the directory entry)
- Thinking FAT supports Unix-style permissions or hard links
- Not knowing FAT12/16/32 differ mainly in address width and volume-size limits
- Assuming FAT is journaled like NTFS or ext4
Best Answer (HR Friendly)
“FAT is one of the simplest file systems — it keeps one shared table that tracks, cluster by cluster, which piece of data comes next for each file, almost like a chain of breadcrumbs. That simplicity is why it works on almost every device, from cameras to USB sticks, but it also means it has no built-in safety net if power is cut mid-write, so it can get corrupted and need a full disk check to fix.”
Code Example
#define FAT_END_OF_CHAIN 0xFFFFFFFF
#define FAT_FREE_CLUSTER 0x00000000
/* fat[] is the shared allocation table: fat[i] = next cluster after i */
void read_file(unsigned int fat[], unsigned int first_cluster) {
unsigned int cluster = first_cluster;
while (cluster != FAT_END_OF_CHAIN) {
read_cluster_data(cluster); /* read this cluster’s bytes */
cluster = fat[cluster]; /* follow the chain to the next cluster */
}
}Follow-up Questions
- What is the difference between FAT12, FAT16, and FAT32?
- Why does FAT typically keep two copies of the allocation table?
- How does exFAT improve on FAT32 for large removable media?
- Why is FAT prone to fragmentation over time?
MCQ Practice
1. In FAT, where is the number of a file's first cluster stored?
The directory entry records the file name, size, attributes, and the index of the first cluster; the FAT then chains the rest.
2. What does a FAT entry for a given cluster contain?
Each FAT slot corresponds to one cluster and stores either the next cluster number, a free marker, or an end-of-chain marker.
3. Why is FAT considered less crash-resilient than a journaling file system?
Without journaling, an interrupted write can desynchronize the FAT and actual cluster usage, requiring a full disk scan to repair.
Flash Cards
What does FAT stand for? — File Allocation Table.
How does FAT track a file's data? — As a linked-list-style chain of cluster numbers stored in a shared table.
Where is the first cluster of a file recorded? — In the file's directory entry.
Why is FAT less crash-safe than NTFS or ext4? — It has no journal, so interrupted writes can corrupt the table and require a full disk check.