Encyclopedia > FAT

  Article Content

File Allocation Table

Redirected from FAT

File Allocation Table (FAT) is the main file system developed for MS-DOS and Windows. The FAT file system is considered relatively uncomplicated, and because of that it is popular format for floppy disks; moreover, it is supported by virtually all existing operating systems for the IBM PC, and because of that it's often used to share data between several operating systems booting on the same computer (a multiboot environment).

FAT is a relatively early file system design, and because of that it suffered from several problems. First, its simple file layout allows for fragmentation[?], which leads to significant slowdowns during file system operations. Secondly, FAT was not designed for redundancy in the case of system failure. Thirdly, the first versions of FAT allowed file name[?] sizes of only up to 11 characters (file name of 8 and a file extension of 3), although a work-around was developed when Microsoft implemented VFAT, that would allow file names of up to 255 characters. Finally, the large cluster size in many versions of FAT meant that a lot of space was being wasted on padding small files to the cluster size.

FAT file system structure A FAT file system on a partition consists of the following parts:

  1. The partition boot record, consisting of one or several sectors in the beginning of the disk, which include some basic file system information (in particular, its type), and the operating system's boot loader code
  2. The File Allocation Table is a linked list that stores the logical order of the disk's clusters. Clusters are small blocks of contiguous and related space in the data area. Clusters are tied into chains that represent files. These chains are not nessisarily stored adjacently on the disk's surface but are instead fragmented throughout the data area. Each file record, or inode, (discussed below) contains the location of the file's first cluster. Each entry in the FAT contains the location of the next logical cluster. The number of bits used to address the clusters determine the FAT size. Common FAT sizes are 12, 16 and 32 bits. The FAT actually exists as one or more (usually 2) identical copies, kept as redundancies to prevent accidental data loss.
  3. The root directory for the partition (which has a maximal size, written inside the boot record) contains records for files and subdirectories inside it. The records, or inodes, for each file include names, first disk cluster, creation dates, file attributes and so on.
  4. The data area is where file data and inodes are stored and takes up most of the partition. It is divided into small units of space called clusters. The size of files and subdirectories can be increased arbitrarily (as long as there are free clusters) by simply adding more links to the file's chain in the FAT. Note, however, that each cluster can be taken only by one file, and so if a 20-byte file resides in a 32,768-byte cluster, 32,748 bytes are wasted.

In order to store long file names (LFN) on a FAT file system, Windows 95 and above use an ingenious trick - adding phoney file records into the directory tables. The records are marked with attributes that are impossible for a regular file and because of that they're ignored by most old MS-DOS programs that access FAT directly. Each phoney record can contain up to 13 UCS-2 characters (26 bytes), gaining about 15 bytes in addition to the old 8 + 3 by using fields in the record where normal records contain file size and cluster number.

FAT history FAT made its debut with the first version of MS-DOS in 1983. Initially it did not even support subdirectories. MS-DOS version 2 included support for them. Since both were intended for use mainly on floppy disks, in order to save on space, 12-bit cluster numbers were used, resulting in a maximum of 212 = 4,096 clusters. Clusters at that time were usually 512 bytes big, meaning the floppy could hold up to 2 megabytes - which was enough. File names were built according to the 8 + 3 pattern. This initial version of FAT became known as FAT12.

However, since version 2, DOS also supported FAT with 16-bit cluster numbers, for the naturally larger hard disk drives. That way, there could be up to 216 = 65,536 clusters. Even with 512-byte clusters, this could give up to 32 megabytes - enough for XT hard drives, either 10 or 20 megabytes in size. This version of FAT is known simply as FAT, or FAT16 (in the newer documents).

As hard drives grew in size, however, 512-byte clusters were not enough, and bigger sizes were used. 65,536 8,192-byte clusters (512 megabytes) were sufficient for the 400 megabyte disks which were standard issue when Windows 95 was released. However, one of the user experience goals that the designers of Windows 95 wanted to achieve was the use of long file names in the new operating system. The long file names were implemented using a clever work-around in the way FAT tables are laid out (see above). The new version of the file system became known as VFAT (Virtual FAT), after the Windows 95 VxD (device driver) that's used by the operating system to work with it. VFAT is supported by Windows 95 and above and Windows NT 4.0 and above.

By 1997, the cluster growth possibility was exhausted. The maximum cluster size in Windows FAT was 32,768 bytes (Windows NT could create partitions with clusters of 65,536 bytes, which could be used by Windows 95, but this was wasteful when keeping small files in mind, and did not solve the broader issue). For the next release of Windows, Microsoft decided to implement a newer generation of FAT, which 32-bit cluster numbers (only 28 bits are currently used, giving a total of 228 = 268,435,456 clusters. In these conditions, cluster sizes could be lowered again to 4,096 bytes, giving the (so far) adequate figure of 1 terabyte for the whole file system. As a further bonus, lower cluster size meant space was utilized more efficiently. In addition, several changes were made to other filesystem structures. The new FAT version became known as FAT32. This version is supported in Windows 95 OSR 2 and above, and Windows 2000 and above.

The alternative IBM PC operating systems, for example OS/2, Linux, FreeBSD, and BeOS, have all supported FAT, and most have gained support for VFAT and FAT32 shortly after the appropriate Windows versions were released. Early Linux distributions also supported a format known as UMSDOS, which was nothing more than FAT with the UNIX file properties (e.g. long file name and access permissions) stored in a separate file called --linux-.---. UMSDOS was mostly dropped after VFAT was released, although it still remains in the Linux kernel sources.

Since Microsoft has announced the discontinuation of the DOS line of succession with Windows ME, it remains unlikely that any new versions of FAT appear. For most purposes, the NTFS file system that was developed for the Windows NT line is superior to FAT from the points of view of efficiency, performance and reliability. However, FAT is likely to stay for a long time, both as the file system for the lower-end versions of Windows (currently, XP Personal), as well as the ideal file system for small drives, like the floppies.

See also: Drive letter assignment

All Wikipedia text is available under the terms of the GNU Free Documentation License

  Search Encyclopedia

Search over one million articles, find something about almost anything!
  Featured Article

... Gorges Dam will be a major supplier of hydroelectricity. Demographics Province is mostly Han Chinese. There is a considerable Miao and Tujia population in the ...