File Allocation Table


File Allocation Table is a file system developed for personal computers and was the default file system for the DOS and Windows 9x operating systems. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. The increase in disk drive capacity over time drove modifications to the design that resulted in versions: FAT12, FAT16, FAT32, and exFAT.
FAT was replaced with NTFS as the default file system on Microsoft operating systems starting with Windows XP. Nevertheless, FAT continues to be commonly used on relatively small capacity solid-state storage technologies such as USB flash drives, SD cards, MultiMediaCards and eMMC because of its compatibility across operating systems and embedded systems, and ease of implementation.

Uses

Historical

FAT was used on hard disks throughout the DOS and Windows 9x eras. Microsoft introduced NTFS with the Windows NT platform in 1993, but FAT remained the standard for the home user until the introduction of Windows XP in 2001. Windows Me was the final version of Windows to use FAT as its default file system.
For floppy disks, FAT has been standardized as ECMA-107 and ISO/IEC 9293:1994. These standards cover FAT12 and FAT16 with only short 8.3 filename support; long filenames with VFAT were partially patented. While FAT12 is used on floppy disks, FAT16 and FAT32 are typically found on the larger media.

Modern

FAT is used internally for the EFI system partition in the boot stage of EFI-compliant computers.
FAT is still used in drives expected to be used by multiple operating systems, such as in shared Windows and Linux environments. Microsoft Windows additionally comes with a pre-installed tool to convert a FAT file system into NTFS directly without the need to rewrite all files, though this cannot be reversed easily.
The FAT file system is used in removable media such as floppy disks, super-floppies, memory and flash memory cards or USB flash drives. FAT is supported by portable devices such as PDAs, digital cameras, camcorders, media players, mobile phones, game consoles, as well as embedded systems such as boomboxes and DVD players and vehicle audio systems with built-in USB ports and SD card readers.
The DCF file system adopted by almost all digital cameras since 1998 defines a logical file system with 8.3 filenames and makes the use of either FAT12, FAT16, FAT32 or exFAT mandatory for its physical layer for compatibility.

Technical details


The file system uses an index table stored on the device to identify chains of data storage areas associated with a file, the File Allocation Table. The FAT is statically allocated at the time of formatting. The table is a linked list of entries for each cluster, a contiguous area of disk storage. Each entry contains either the number of the next cluster in the file, or else a marker indicating the end of the file, unused disk space, or special reserved areas of the disk. The root directory of the disk contains the number of the first cluster of each file in that directory. The operating system can then traverse the FAT, looking up the cluster number of each successive part of the disk file as a cluster chain until the end of the file is reached. Sub-directories are implemented as special files containing the directory entries of their respective files.
Each entry in the FAT linked list is a fixed number of bits: 12, 16 or 32. The maximum size of a file or a disk drive that can be accessed is the product of the largest number that can be stored in the entries and the size of the disk cluster. Even if only one byte of storage is needed to extend a file, an entire cluster must be allocated to it. As a result, large numbers of small files can result in clusters being allocated that may contain mostly "empty" data to meet the minimum cluster size.
Originally designed as an 8-bit file system, the maximum number of clusters must increase as disk drive capacity increases, and so the number of bits used to identify each cluster has grown. The successive major variants of the FAT format are named after the number of table element bits: 12, 16, and 32.

Variants

There are several variants of the FAT file system. FAT16 refers to both the original group of FAT file systems with 16-bit wide cluster entries and also to later variants. "VFAT" is an optional extension for long file names, which can work on top of any FAT file system. Volumes using VFAT long-filenames can be read also by operating systems not supporting the VFAT extension.

Original 8-bit FAT

The original FAT file system was designed and implemented by Marc McDonald, based on a series of discussions between McDonald and Bill Gates.
It was introduced with 8-bit table elements in a precursor to Microsoft's Standalone Disk BASIC-80 for an 8080-based successor of the NCR 7200 model VI data-entry terminal, equipped with 8-inch floppy disks, in 1977 or 1978.
In 1978, Standalone Disk BASIC-80 was ported to the 8086 using an emulator on a DEC PDP-10, since no real 8086 systems were available at this time.
The FAT file system was also used in Microsoft's MDOS/MIDAS, an operating system for 8080/Z80 platforms written by McDonald since 1979.
The Standalone Disk BASIC version supported three FATs, whereas this was a parameter for MIDAS. Reportedly, MIDAS was also prepared to support 10-bit, 12-bit and 16-bit FAT variants. While the size of directory entries was 16 bytes in Standalone Disk BASIC, MIDAS instead occupied 32 bytes per entry.
Tim Paterson of Seattle Computer Products was first introduced to Microsoft's FAT structure when he helped Bob O'Rear adapting the Standalone Disk BASIC-86 emulator port onto SCP's S-100 bus 8086 CPU board prototype during a guest week at Microsoft in May 1979. The final product was shown at Lifeboat Associates' booth stand at the National Computer Conference in New York on June 4–7, 1979, where Paterson learned about the more sophisticated FAT implementation in MDOS/MIDAS and McDonald talked to him about the design of the file system.

FAT12

Between April and August 1980, while borrowing the FAT concept for SCP's own 8086 operating system QDOS 0.10, Tim Paterson extended the table elements to 12 bits, reduced the number of FATs to two, redefined the semantics of some of the reserved cluster values, and modified the disk layout, so that the root directory was now located between the FAT and the data area for his implementation of FAT12. Paterson also increased the nine-character filename length limit to eleven characters to support CP/M-style 8.3 filenames and File Control Blocks. The format used in Microsoft Standalone Disk BASIC's 8-bit file system precursor was not supported by QDOS. By August 1980, QDOS had been renamed to 86-DOS. Starting with 86-DOS 0.42, the size and layout of directory entries was changed from 16 bytes to 32 bytes in order to add a file date stamp and increase the theoretical file size limit beyond the previous limit of 16 MB.
86-DOS 1.00 became available in early 1981. Later in 1981, 86-DOS evolved into Microsoft's MS-DOS and IBM PC DOS.
The capability to read previously formatted volumes with 16-byte directory entries was dropped with MS-DOS 1.20.
FAT12 used 12-bit entries for the cluster addresses; some values were reserved to mark the end of a chain of clusters, to mark unusable areas of the disk, or for other purposes, so the maximum number of clusters was limited to 4078. To conserve disk space, two 12-bit FAT entries used three consecutive 8-bit bytes on disk, requiring manipulation to unpack the 12-bit values. This was sufficient for the original floppy disk drives, and small hard disks up to 32 megabytes. The FAT16B version available with DOS 3.31 supported 32-bit sector numbers, and so increased the volume size limit.
All the control structures fit inside the first track, to avoid head movement during read and write operations. Any bad sector in the control structures area would make the disk unusable. The DOS formatting tool rejected such disks completely. Bad sectors were allowed only in the file data area. Clusters containing bad sectors were marked unusable with the reserved value 0xFF7 in the FAT.
While 86-DOS supported three disk formats on 8-inch floppy drives, IBM PC DOS 1.0, released with the original IBM Personal Computer in 1981, supported only an 8-sector floppy format with a formatted capacity of 160 KB for single-sided 5.25-inch floppy drives, and PC DOS 1.1 added support for a double-sided format with 320 KB. PC DOS 2.0 introduced support for 9-sector floppy formats with 180 KB and 360 KB.
86-DOS 1.00 and PC DOS 1.0 directory entries included only one date, the last modified date. PC DOS 1.1 added the last modified time. PC DOS 1.x file attributes included a hidden bit and system bit, with the remaining six bits undefined. At this time, DOS did not support sub-directories, but typically there were only a few dozen files on a diskette.
The PC XT was the first PC with an IBM-supplied hard drive, and PC DOS 2.0 supported that hard drive with FAT12. The fixed assumption of 8 sectors per clusters on hard disks practically limited the maximum partition size to 16 MB for 512 byte sectors and 4 KB clusters.
The BIOS Parameter Block was introduced with PC DOS 2.0 as well, and this version also added read-only, archive, volume label, and directory attribute bits for hierarchical sub-directories.
MS-DOS 3.0 introduced support for high-density 1.2 MB 5.25-inch diskettes, which notably had 15 sectors per track, hence more space for the FATs.
FAT12 remains in use on all common floppy disks, including 1.44 MB and later 2.88 MB disks.