1.3 File Allocation Tables

Immediately following a volume boot record in a partition, comes the file allocation tables (FAT tables abbreviated). There are almost always two FAT tables per file system. The system only actively uses one FAT table, and so the other FAT tables serve as back-ups.

Despite the name file allocation table, the purpose of the FAT table is not to allocate files, but rather to allocate and manage the linkage of clusters. Clusters are the basic unit of storage of the FAT file system. They are made up of one or more physical sectors, how many depends on how large the file system is. For example, on a 720 KB floppy disk the cluster size would probably be 2 sectors, and on a hard disk partition, probably 4 or more sectors.

The numbers 12, 16, and 32 that usually follow the word FAT in describing the exact version of file system refer to the number of bits that represent each cluster number in the FAT table. The FAT table is simply a linear array of numbers who’s index represents a cluster on the disk. For example in a FAT16 file system, the fiftieth 16 bit value in the FAT table would correspond to the fiftieth cluster in the file system.

The allocation of a cluster is determined through the value its FAT table entry. Unused cluster should have a FAT table value of 0, while used clusters should have either the number of another cluster, or the EOF3 value.

If the value of a FAT table entry is set to a cluster number, it is said to be chained to that cluster. The cluster that the value of the entry refers to represents the next block of data in a file. The repeated iteration of this process creates cluster chains.

When a file is written to a FAT file system, the operating system must first determine how many clusters it will take to hold the contents of that file. For example on a file system with a cluster size of 2048 bytes (four 512 byte sectors), a 5000 byte file would take three clusters to hold its contents.


Footnotes

(3)

not the same as the EOF character used in the ASCII text encoding system.