Wizcode was founded in 2001. We now have more than 100,000 customers worldwide.

A brief introduction to FAT (File Allocation Table) formats

by Anton Tomov on Aug 14


History

FATThe FAT filesystem was created by Bill Gates and Marc McDonald in 1977 for managing disks in Microsoft Disk BASIC. In August 1980 Tim Paterson incorporated FAT into his 86-DOS operating system for the S-100 8086 CPU boards; the filesystem was the main difference between 86-DOS and its predecessor, CP/M.

The name originates from the usage of a table which centralizes the information about which areas belong to files, are free or possibly unusable, and where each file is stored on the disk. To reduce the management complexity, disk space is allocated to files in contiguous groups of hardware sectors called clusters. The maximum possible number of clusters has dramatically increased over time, and the number of bits required to identify a cluster is used to name the successive major versions of the format. The FAT standard has also evolved in several ways where backward compatibility with existing software has been preserved.

 

FAT12

This initial version of FAT is now referred to as FAT12. Designed to be a filesystem for floppy disks, it had a number of limitations - no support for hierarchical directories, cluster addresses were "only" 12 bits long (which limited cluster count to 4096 and made the FAT code manipulating a bit tricky) and the disk size was stored as a 16-bit count of sectors, which limited the maximum partition size to 32MB.

FAT16

In 1984 IBM released the PC AT, which featured a 20 MB hard disk. Microsoft introduced MS-DOS 3.0 in parallel. Cluster addresses were increased to 16-bit, allowing for a greater number of clusters (up to 65,517) and consequently much greater file-system sizes. However, the maximum possible number of sectors and the maximum (partition, rather than disk) size of 32 MB did not change. Therefore, although technically already "FAT16", this format was not yet what today is commonly understood under this name.

Finally in November 1987, Compaq DOS 3.31 introduced what is today called the FAT16 format, with the expansion of the 16-bit disk sector index to 32 bits. The result was initially called the DOS 3.31 Large File System.

In 1988 the improvement became more generally available through MS-DOS 4.0 and OS/2 1.1. The limit on partition size was now dictated by the 8-bit signed count of sectors-per-cluster, which had a maximum power-of-two value of 64. With the usual hard disk sector size of 512 bytes, this gives 32KB clusters, thereby fixing the "definitive" limit for the FAT16 partition size at 2 gigabytes. On magneto-optical media, which can have 1 or 2KB sectors, the limit is proportionally greater.

Much later, Windows NT increased the maximum cluster size to 64KB by considering the sectors-per-cluster count as unsigned. However, the resulting format was not compatible with any other FAT implementation of the time, and it generated massive internal fragmentation.

FAT32

In order to overcome the volume size limit of FAT16, while still allowing DOS real-mode code to handle the format without unnecessarily reducing the available conventional memory, Microsoft decided to implement a newer generation of FAT, known as FAT32, with cluster counts held in a 32-bit field, of which 28 bits are currently used.

In theory, this should support a total of approximately 268,435,456 (228) clusters, allowing for drive sizes in the range of 8 terabytes with 32K clusters, but the boot sector uses a 32 bit field to limit volume size to 232 sectors (2TB on a hard disk with 512 byte sectors).

The maximum possible size for a file on a FAT32 volume is 4GB minus 1 byte (232 - 1 bytes).


  • AddThis Social Bookmark Button

Saved under Technical articles File systems FAT  •  0 Comment(s)  •  42 Trackback(s)
Only registered users are able to post comments. Please login or get your account in a minute.