FAT File System
The File Allocation Table (FAT) file system was designed for small disks and simple directory structures. The file allocation tables and the root folder are stored in a fixed location so that the files needed to start the system can be located easily. The layout of the disk is as shown below:
There have been several versions of FAT, including FAT12, FAT16 and FAT32. The position of the duplicate FAT can vary depending on the version.
File space on a FAT volume is allocated in clusters. The default cluster size depends on the size of the volume, but the cluster number must be no longer than 16 bits and must be a power of 2.
The file allocation table contains the following types of information about each cluster on the volume (the example given is for FAT16):
- Unused (0x0000)
- Cluster in use by a file
- Bad cluster (0xFFF7)
- Last cluster in a file (0xFFF8-0xFFFF)
When a new file is created it is given the first available location on the volume. The starting cluster number is the address of the first cluster used by the file. Each cluster contains a pointer to the next cluster in the file, or an indication (0xFFFF) that it is the end of the file.
The diagram below shows three files. Doc1.txt is large enough to use three clusters. Doc2.txt is a fragmented file that also requires three clusters. Doc3.txt is a small file that fits completely in one cluster. In each case, the folder structure points to the first cluster of the file.
Next: FAT Folder Structure