File Allocation Table (FAT) in File Systems: Efficient File Storage and Access

Learn about the File Allocation Table (FAT), a method for storing and accessing files on a disk. This guide explains how FAT improves upon linked list allocation, enabling faster random access to file blocks through a table-based approach.



File Allocation Table (FAT) in File Systems

Addressing the Limitations of Linked List Allocation

Linked list allocation, a method for storing files on a disk, requires traversing the list to access a specific block. This makes random access to blocks slow and inefficient. The File Allocation Table (FAT) improves upon this by providing a way to directly access any block within a file.

How FAT Works

FAT uses a table that stores the location of each block within a file. The table has one entry for each block on the disk, and the entries are indexed by the block number. To access a block, the file system simply looks up the block number in the FAT to get the block’s location on the disk. This makes random access to file blocks significantly faster than linked list methods. Because accessing the FAT repeatedly can be slow, it is usually cached in RAM to improve efficiency.

Advantages of FAT

  • Full Block Utilization: The entire allocated block is used to store data.
  • Improved Reliability: A bad block doesn't necessarily affect other blocks.
  • Random Access: Allows direct access to any block (although slower than contiguous allocation).
  • Efficient Access: Only the FAT needs to be accessed to locate a block within a file.

Disadvantages of FAT

  • Space Overhead: Requires a separate FAT entry for each block on the disk, consuming storage space.
  • Large FAT Size: The size of the FAT can become significant if the disk has many blocks.
  • Internal Fragmentation: Increasing block size can reduce the number of FAT entries, but this also increases internal fragmentation (wasted space within a block).