The FAT (File Allocation Table) Explained

The File Allocation Table, or FAT, is a file system architecture used by DOS - the host operating system is able to understand the contents of a volume (a floppy disk, a hard disk, etc) by reading the FAT.

When a volume is formatted, these sections are created and written to:

1) Reserved Sectors - Information about the reserved sectors, including the 'boot sector' (also known as the VBR, the Volume Boot Record).
2) The FAT Region - Two identical copies of an "index table" which holds the details of all files and directories on the disk (these map directly to the Data Region).
3) The Root Directory Region - a dedicated "index table" that stores details of all files and directories that exist in the root directory.
4) The Data Region - this is where all files and directories are stored.

In the early PC days, there were two types of File Allocation Table structure: FAT12 and FAT16. FAT12 is so-called because it uses 12-bit entries for the cluster addresses. FAT16 uses 16-bit entries for the cluster addresses. Both FAT12 and FAT16 support only DOS 8.3 filenames. FAT32 was introduced with Windows 95 OSR2 (OEM Service Release 2). FAT32 can use much smaller cluster sizes, which helps reduce actual disk usage (files are stored at cluster size boundaries, so a 1-byte file in FAT16 may well use up 32 KB because the cluster size is 32 KB! The same file in FAT32 uses just 4 KB, as the cluster size is 4 KB. FAT32 also increased the partition size limit of 2 GB that FAT16 had.

Floppy Disks

In the case of DOS floppy disks, these all use FAT12. A volume using FAT12 has a storage limit of 32 MB and 4,068 files. There is also a limit on the name of an absolute directory path of 66 characters. A volume using FAT16 has a storage limit of 2 GB and 65,460 files.

Each entry in the FAT also has the following attributes:

  • Directory - set if the entry is a directory, not a file.
  • Read-Only - set if the file should not be altered. Read-only attributes on directories are usually ignored.
  • System - set if the file is an important system file, necessary for the operating system to function.
  • Hidden - set if the file is hidden. By default, the DOS 'dir' command does not show hidden files.
  • Archive - set if the file is awaiting backup. This attribute was sometimes used by third-party backup software which would un-set this flag after the file had been backed up.