| FAT12 | FAT16 | FAT32 | |
|---|---|---|---|
| Developer | Microsoft | ||
| Full Name | File Allocation Table | ||
| (12-bit version) | (16-bit version) | (32-bit version) | |
| Introduced | 1977 (Microsoft Disk BASIC) | July 1988 (MS-DOS 4.0) | August 1996 (Windows 95 OSR2) |
| Partition identifier | 0x01 (MBR) | 0x04, 0x06, 0x0E (MBR) | 0x0B, 0x0C (MBR) EBD0A0A2-B9E5-4433 -87C0-68B6B72699C7 (GPT) |
| Structures | |||
| Directory contents | Table | ||
| File allocation | Linked List | ||
| Bad blocks | Linked List | ||
| Limits | |||
| Max file size | 32 MiB | 2 GiB | 4 GiB |
| Max number of files | 4,077 | 65,517 | 268,435,437 |
| Max filename size | 8.3 or 255 characters when using LFNs | ||
| Max volume size | 32 MiB | 2 GiB 4 GiB with some implementations | 2 TiB |
| Features | |||
| Dates recorded | Creation, modified, access | ||
| Date range | January 1, 1980 - December 31, 2107 | ||
| Forks | Not natively | ||
| Attributes | Read-only, hidden, system, volume label, subdirectory, archive | ||
| Permissions | No | ||
| Transparent compression | Per-volume, Stacker, DoubleSpace, DriveSpace | No | |
| Transparent encryption | Per-volume only with DR-DOS | No | |
File Allocation Table (FAT) is a partially patentedPatents apply to technology supporting Long File Names (Microsoft) and extended attributes (IBM) within the file system, but not the core file system itself. file system developed by Microsoft for MS-DOS and is the primary file system for consumer versions of Microsoft Windows up to and including Windows Me.
The FAT file system is considered relatively uncomplicated, and is consequently supported by virtually all existing operating systems for personal computers. This ubiquity makes it an ideal format for floppy disks and solid-state memory cards, and a convenient way of sharing data between disparate operating systems installed on the same computer (a dual boot environment).
The most common implementations have a serious drawback in that when files are deleted and new files written to the media, their fragments tend to become scattered over the entire media making reading and writing a slow process. Defragmentation is one solution to this, but is often a lengthy process in itself and has to be repeated regularly to keep the FAT file system clean.
An entry-level floppy diskette at the time would be 5.25", single-sided, 40 tracks, with 8 sectors per track, resulting in a capacity of slightly less than 160KB. The above limits exceeded this capacity by one or more orders of magnitude and at the same time allowed all the control structures to fit inside the first track, thus avoiding head movement during read and write operations. The limits were successively lifted in the following years, which improved wait-loss dramatically.
Since the sole root directory had to fit inside the first track as well, the maximum possible number of files was limited to a few dozens.
The format of the FAT itself did not change. The 10 MB hard disk on the PC XT had 4 KB clusters. If a 20 MB hard disk was later installed, and formatted with MS-DOS 2.0, the resultant cluster size would be 8 KB, the boundary at 15.9 MB.
MS-DOS 3.0 also introduced support for high-density 1.2 MB 5.25" diskettes, which notably had 15 sectors per track, hence more space for FAT. This probably prompted a dubious optimization of the cluster size, which went down from 2 sectors to just 1. The net effect was that high density diskettes were significantly slower than older double density ones.
To allow the use of more partitions in a compatible way a new partition type was introduced (in MS-DOS 3.2, January 1986), the extended partition, which was actually just a container for additional partitions called logical drives. Originally only 1 logical drive was possible, allowing the use of hard-disks up to 64 MB. In MS-DOS 3.3 (August 1987) this limit was increased to 24 drives; it probably came from the compulsory letter-based C: - Z: disk naming. The logical drives were described by on-disk structures which closely resemble MBRs, probably to simplify coding, and they were chained/nested in a way analogous to Russian matryoshka dolls. Only one extended partition was allowed.
Prior to the introduction of extended partitions, some hard disk controllers (which at that time were separate option boards, since the IDE standard did not yet exist) could make large hard disks appear as two separate disks. Alternatively, special software drivers, like Ontrack's Disk Manager could be installed for the same purpose
In 1988 the improvement became more generally available through MS-DOS 4.0. 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 32 KB clusters, hence fixing the "definitive" limit for the FAT16 partition size at 2 gigabytes. On magneto-optical media, which can have 1 or 2 KB sectors, the limit is proportionally greater.
Much later, Windows NT increased the maximum cluster size to 64 KB 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 anyway, generated massive internal fragmentation. Windows 98 also supported reading and writing this variant, but its disk utilities didn't work with it.
Interestingly, the VFAT driver actually appeared before Windows 95, in Windows for Workgroups 3.11, but was only used for implementing 32-bit File Access, a higher performance protected mode file access method, bypassing DOS and directly using either the BIOS, or, better, the Windows-native protected mode disk drivers. It was a backport; Microsoft's ads for WfW 3.11 said 32-bit File Access was based on "the 32-bit file system from our Chicago project".
In Windows NT, support for long file names on FAT started from version 3.5.
In theory, this should support a total of approximately 268,435,438 (< 228) clusters, allowing for drive sizes in the range of 2 terabytes. However, due to limitations in Microsoft's scandisk utility, the FAT is not allowed to grow beyond 4,177,920 (< 222) clusters, placing the volume limit at 124.55 gigabytes, unless "scandisk" is not needed Limitations of FAT32 File System, Microsoft knowledge base article 184006.
FAT32 was introduced with Windows 95 OSR2, although reformatting was needed to use it, and DriveSpace 3 (the version that came with Windows 95 OSR2 and Windows 98) never supported it. Windows 98 introduced a utility to convert existing hard disks from FAT16 to FAT32 without loss of data. In the NT line, support for FAT32 arrived in Windows 2000.
Windows 2000 and Windows XP can read and write to FAT32 filesystems of any size, but the format program on these platforms can only create FAT32 filesystems up to 32 GB. Thompson and Thompson (2003) writeThompson, Robert Bruce and Thompson, Barbara Fritchman; PC Hardware in a Nutshell, 3rd Edition,, O'Reilly, ISBN 059600513X (p. 506: Microsoft "bizarrely" saying the 32 GB limitation is by design) that "Bizarrely, Microsoft states that this behavior is by design." Microsoft's knowledge base article 184006 indeed confirms the limitation and the by design statement, but gives no rationale or explanation. Peter Norton's opinionNorton, Peter (2002); Peter Norton's New Inside the PC, Sams Publishing, ISBN 0672322897 (p. 428: "Microsoft has intentionally crippled the FAT32 file system") is that "Microsoft has intentionally crippled the FAT32 file system."
The maximum possible size for a file on a FAT32 volume is 4 GiB minus 1 B (232-1 bytes). For most users, this has become the most nagging limit of FAT32 as of 2005, since video capture and editing applications can easily exceed this limit, as can the system swap file.
Mac OS using PC Exchange stores its various dates, file attributes and long filenames in a hidden file called FINDER.DAT, and Resource Forks (a common Mac OS ADS) in a subdirectory called RESOURCE.FRK, in every directory where they are used. From PC Exchange 2.1 onwards, they store the Mac OS long filenames as standard FAT long filenames and convert FAT filenames longer than 31 characters to unique 31-character filenames, which can then be made visible to Macintosh applications.
Mac OS X stores metadata (Resource Forks, file attributes, other ADS) in a hidden file with a name constructed from the owner filename prefixed with "._", and Finder stores some folder and file metadata in a hidden file called ".DS_Store".
OS/2 heavily depends on extended attributes (EAs) and stores them in a hidden file called "EA DATA. SF" in the root directory of the FAT12 or FAT16 volume. This file is indexed by 2 previously reserved bytes in the file's (or directory's) directory entry. In the FAT32 format, these bytes hold the upper 16 bits of the starting cluster number of the file or directory, hence making it difficult to store EAs on FAT32. Extended attributes are accessible via the Workplace Shell desktop, through REXX scripts, and many system GUI and command-line utilities (such as 4OS2).
Windows NT supports the handling of extended attributes in HPFS, NTFS, and FAT. It stores EAs on FAT using exactly the same scheme as OS/2, but does not support any other kind of ADS as held on NTFS volumes. Trying to copy a file with any ADS other than EAs from an NTFS volume to a FAT volume gives a warning message with the names of the ADSs that will be lost.
Windows 2000 onward acts exactly as Windows NT, except that it ignores EAs when copying to FAT32 without any warning (but shows the warning for other ADSs, like "Macintosh Finder Info" and "Macintosh Resource Fork").
Since Microsoft has announced the discontinuation of its MS-DOS-based consumer operating systems with Windows Me, it remains unlikely that any new versions of FAT will 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; its main drawbacks are the size overhead for small volumes and the very limited support by anything other than the NT-based versions of Windows, since the exact specification is a trade secret of Microsoft, which in turn makes it difficult to use a DOS floppy for recovery purposes. Microsoft provided a recovery console to work around this issue, but for security reasons it severely limited what could be done through the Recovery Console by default.
FAT is still the normal filesystem for removable media (with the exception of CDs and DVDs), with FAT12 used on floppies, and FAT16 on most other removable media (such as flash memory cards for digital cameras and USB flash drives). Most removable media is not yet large enough to benefit from FAT32, although some larger flash drives do make use of it. FAT is used on these drives for reasons of compatibility and size overhead, as well as the fact that file permissions on removable media are likely to be more trouble than they are worth.
The FAT32 formatting support in Windows 2000 and XP is limited to drives of 32 gigabytes, which effectively forces users of modern hard drives either to use NTFS or to format the drive using third party tools such as a port of mkdosfs or fat32format.
The following is an overview of the order of structures in a FAT partition or disk:
| Boot sector | More reserved sectors (optional) | File Allocation Table #1 | File Allocation Table #2 | Root Directory (FAT12/16 only) | Data Region (for files and directories) ... The Rest of the Disk |
A FAT file system is composed of four different sections.
Common structure of the first 36 bytes used by all FAT versions:
| Byte Offset | Length (bytes) | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x00 | 3 | Jump instruction (to skip over header on boot) | ||||||||||||||||
| 0x03 | 8 | OEM Name (padded with spaces). MS-DOS checks this field to determine which other parts of the boot record can be relied on [http://groups.google.co.uk/group/comp.os.msdos.programmer/msg/79de2d76832cfbd6. Common values are IBM 3.3 (with two spaces between the "IBM" and the "3.3") and MSDOS5.0.
| ||||||||||||||||
| 0x0b | 2 | Bytes per sector. The BIOS Parameter Block starts here. | ||||||||||||||||
| 0x0d | 1 | Sectors per cluster | ||||||||||||||||
| 0x0e | 2 | Reserved sector count (including boot sector) | ||||||||||||||||
| 0x10 | 1 | Number of file allocation tables | ||||||||||||||||
| 0x11 | 2 | Maximum number of root directory entries | ||||||||||||||||
| 0x13 | 2 | Total sectors (if zero, use 4 byte value at offset 0x20) | ||||||||||||||||
| 0x15 | 1 | Media descriptor |
| 0xF8 | Single sided, 80 tracks per side, 9 sectors per track |
| 0xF9 | Double sided, 80 tracks per side, 9 sectors per track |
| 0xFA | Single sided, 80 tracks per side, 8 sectors per track |
| 0xFB | Double sided, 80 tracks per side, 8 sectors per track |
| 0xFC | Single sided, 40 tracks per side, 9 sectors per track |
| 0xFD | Double sided, 40 tracks per side, 9 sectors per track |
| 0xFE | Single sided, 40 tracks per side, 8 sectors per track |
| 0xFF | Double sided, 40 tracks per side, 8 sectors per track |
Further structure used by FAT12 and FAT16, also known as Extended BIOS Parameter Block:
| Byte Offset | Length (bytes) | Description |
|---|---|---|
| 0x24 | 1 | Physical drive number |
| 0x25 | 1 | Reserved ("current head") |
| 0x26 | 1 | Signature |
| 0x27 | 4 | ID (serial number) |
| 0x2b | 11 | Volume Label |
| 0x36 | 8 | FAT file system type, padded with blanks (0x20), e.g.: "FAT12 ", "FAT16 " |
| 0x3e | 448 | Operating system boot code |
| 0x1FE | 2 | End of sector marker (0x55 0xAA) |
Further structure used by FAT32:
| Byte Offset | Length (bytes) | Description |
|---|---|---|
| 0x24 | 4 | Sectors per file allocation table |
| 0x28 | 2 | FAT Flags |
| 0x2a | 2 | Version |
| 0x2c | 4 | Cluster number of root directory start |
| 0x30 | 2 | Sector number of FS Information Sector |
| 0x32 | 2 | Sector number of a copy of this boot sector |
| 0x34 | 12 | Reserved |
| 0x40 | 1 | Physical Drive Number |
| 0x41 | 1 | Reserved |
| 0x42 | 1 | Signature |
| 0x43 | 4 | ID (serial number) |
| 0x47 | 11 | Volume Label |
| 0x52 | 8 | FAT file system type: "FAT32 " |
| 0x5a | 420 | Operating system boot code |
| 0x1FE | 2 | End of sector marker (0x55 0xAA) |
The boot sector is portrayed here as found on e.g. an OS/2 1.3 boot diskette. Earlier versions used a shorter BIOS Parameter Block and their boot code would start earlier (for example at offset 0x2b in OS/2 1.1).
DOS Plus on the BBC Master 512 did not use conventional boot sectors at all. Data disks omitted the boot sector and began with a single copy of the FAT (the first byte of the FAT was used to determine disk capacity) while boot disks began with a miniature ADFS filesystem containing the boot loader, followed by a single FAT. It could also access standard PC disks formatted to 180 KB or 360 KB, again using the first byte of the FAT to determine capacity.
The File Allocation Table (FAT) is a list of entries that map to each cluster on the partition. Each entry records one of five things:
Each version of the FAT file system uses a different size for FAT entries. The size is indicated by the name, for example the FAT16 file system uses 16 bits for each entry while the FAT32 file system uses 32 bits. This difference means that the File Allocation Table of a FAT32 system can map a greater number of clusters than FAT16, allowing for larger partition sizes with FAT32. This also allows for more efficient use of space than FAT16, because on the same hard drive a FAT32 table can address smaller clusters which means less wasted space.
FAT entry values:
| FAT12 | FAT16 | FAT32 | Description |
|---|---|---|---|
| 0x000 | 0x0000 | 0x?0000000 | Free Cluster |
| 0x001 | 0x0001 | 0x?0000001 | Reserved Cluster |
| 0x002 - 0xFEF | 0x0002 - 0xFFEF | 0x?0000002 - 0x?FFFFFEF | Used cluster; value points to next cluster |
| 0xFF0 - 0xFF6 | 0xFFF0 - 0xFFF6 | 0x?FFFFFF0 - 0x?FFFFFF6 | Reserved values |
| 0xFF7 | 0xFFF7 | 0x?FFFFFF7 | Bad cluster |
| 0xFF8 - 0xFFF | 0xFFF8 - 0xFFFF | 0x?FFFFFF8 - 0x?FFFFFFF | Last cluster in file |
Note that FAT32 uses only 28 bits of the 32 possible bits. The upper 4 bits are usually zero but are reserved and should be left untouched. In the table above these are denoted by a question mark.
The first cluster of the data area is cluster #2. That leaves the first two entries of the FAT unused. In the first byte of the first entry a copy of the media descriptor is stored. The remaining bits of this entry are 1. In the second entry the end-of-file marker is stored. The high order two bits of the second entry are sometimes, in the case of FAT16 and FAT32, used for dirty volume management: high order bit 1: last shutdown was clean; next highest bit 1: during the previous mount no disk I/O errors were detected."The FAT filesystem: FAT"
Aside from the Root Directory Table in FAT12 and FAT16 file systems which occupies the special Root Directory Region location, all Directory Tables are stored in the Data Region.
Legal characters for DOS file names include the following:
The DOS file names are in the OEM character set.
Directory entries, both in the Root Directory Region and in subdirectories, are of the following format:
| Byte Offset | Length | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 0x00 | 8 | DOS file name (padded with spaces) |
| 0x00 | Entry is available and no subsequent entry is in use |
| 0x05 | Initial character is actually 0xE5 |
| 0x2E | 'Dot' entry; either '.' or '..' |
| 0xE5 | Entry has been previously erased and is not available. File undelete utilities must replace this character with a regular character as part of the undeletion process. |
| Bit | Mask | Description |
|---|---|---|
| 0 | 0x01 | Read Only |
| 1 | 0x02 | Hidden |
| 2 | 0x04 | System |
| 3 | 0x08 | Volume Label |
| 4 | 0x10 | Subdirectory |
| 5 | 0x20 | Archive |
| 6 | 0x40 | Device (internal use only, never found on disk) |
| 7 | 0x80 | Unused |
| Bits | Description |
|---|---|
| 15-11 | Hours (0-23) |
| 10-5 | Minutes (0-59) |
| 4-0 | Seconds/2 (0-29) |
| Bits | Description |
|---|---|
| 15-9 | Year (0 = 1980, 127 = 2107) |
| 8-5 | Month (1 = January, 12 = December) |
| 4-0 | Day (1 - 31) |
Long File Names (LFN) are stored on a FAT file system using a trick - adding phoney entries into the Directory Tables. The entries are marked with a Volume Label attribute which is impossible for a regular file and because of that they are ignored by most old MS-DOS programs. Notably, a directory containing only volume labels is considered as empty and is allowed to be deleted; such a situation appears if files created with long names are deleted from plain DOS.
A checksum also allows verification of whether a long file name matches the 8.3 name; such a mismatch could occur if a file was deleted and re-created using DOS in the same directory position. The checksum is calculated using the algorithm below. (Note that pFcbName is a pointer to the name as it appears in a regular directory entry, i.e. the first eight characters are the filename, and the last three are the extension. The dot is implicit. Any unused space in the filename is padded with a space (ASCII 0x20) char. For example, "Readme.txt" would be "README TXT".)
unsigned char lfn_checksum(const unsigned char *pFcbName)
{
int i;
unsigned char sum=0;
for (i=11; i; i--)
sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + *pFcbName++;
return sum;
}
Older versions of PC-DOS mistake LFN names in the root directory for the volume label, and are likely to display an incorrect label.
Each phoney entry can contain up to 13 UTF-16 characters (26 bytes), gaining about 15 bytes in addition to the old 8 + 3 by using fields in the record which contained file size or time stamps (but for security versus disk checking tools the starting cluster field is left unused with a 0 value). See 8.3 for additional explanations.
LFN entries use the following format:
| Byte Offset | Length | Description |
|---|---|---|
| 0x00 | 1 | Sequence Number |
| 0x01 | 10 | Name characters (five UTF-16 characters) |
| 0x0b | 1 | Attributes (always 0x0F) |
| 0x0c | 1 | Reserved (always 0x00) |
| 0x0d | 1 | Checksum of DOS file name |
| 0x0e | 12 | Name characters (six UTF-16 characters) |
| 0x1a | 2 | First cluster (always 0x0000) |
| 0x1c | 4 | Name characters (two UTF-16 characters) |
If a filename contains only lowercase letters, or is a combination of a lowercase basename with an uppercase extension, or vice-versa, has no special characters, and fits within the 8.3 limits, a VFAT entry is not created on Windows NT. Instead, undocumented bits in byte 0x0c of the directory entry are used to indicate that the filename should be considered as entirely or partially lowercase. Specifically, bit 4 means lowercase extension and bit 3 lowercase basename, which allows for combinations such as "example.TXT" or "HELLO.txt" but not "Mixed.txt". Few other operating systems support this. Non-NT Windows versions see all-uppercase filenames if this extension has been used. By default, recent versions of Linux will recognize this extension but won't use it when writing.
| Byte Offset | Length | System | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x0C | 2 | RISC OS | File type, 0x000 - 0xFFF | |||||||||||||||
| 0x0C | 1 | DOS Plus | User-defined file attributes F1-F4 |
| Bit | Mask | Description |
|---|---|---|
| 7 | 0x80 | F1 |
| 6 | 0x40 | F2 |
| 5 | 0x20 | F3 |
| 4 | 0x10 | F4 |
| Bit | Mask | Description |
|---|---|---|
| 0 | 0x0001 | Owner delete requires password |
| 1 | 0x0002 | Owner execute requires password |
| 2 | 0x0004 | Owner write requires password |
| 3 | 0x0008 | Owner read requires password |
| 4 | 0x0010 | Group delete requires password |
| 5 | 0x0020 | Group execute requires password |
| 6 | 0x0040 | Group write requires password |
| 7 | 0x0080 | Group read requires password |
| 8 | 0x0100 | World delete requires password |
| 9 | 0x0200 | World execute requires password |
| 10 | 0x0400 | World write requires password |
| 11 | 0x0800 | World read requires password |
On 2003-12-03 Microsoft announced it would be offering licenses for use of its FAT specification and "associated intellectual property", at the cost of a US $0.25 royalty per unit sold, with a $250,000 maximum royalty per license agreement.
To this end, Microsoft cited four patents on the FAT filesystem as the basis of its intellectual property claims. All four pertain to long-filename extensions to FAT first seen in Windows 95:
Many technical commentators have concluded that these patents only cover FAT implementations that include support for long filenames, and that removable solid state media and consumer devices only using short names would be unaffected.
Additionally, in the document "Microsoft Extensible Firmware Initiative FAT 32 File System Specification, FAT: General Overview of On-Disk Format" published by Microsoft (version 1.03, 2000-12-06), Microsoft specifically grants a number of rights, which many readers have interpreted as permitting operating system vendors to implement FAT.
Microsoft is not the only company to have applied for patents for parts of the FAT file system. Other patents affecting FAT include:
On 2004-09-30 the USPTO rejected all claims of , based primarily on evidence provided by the Public Patent Foundation. Dan Ravicher, the foundation's executive director, said "The Patent Office has simply confirmed what we already knew for some time now, Microsoft's FAT patent is bogus."
According to the PUBPAT press release, "Microsoft still has the opportunity to respond to the Patent Office's rejection. Typically, third party requests for reexamination, like the one filed by PUBPAT, are successful in having the subject patent either narrowed or completely revoked roughly 70% of the time."
On 2005-10-05 the Patent Office announced that, following the re-examination process, it had again rejected all claims of patent 5.579,517, and it additionally found invalid on the grounds that the patent had incorrect assignees.
Finally, on 2006-01-10 the Patent Office ruled that features of Microsoft's implementation of the FAT system were "novel and non-obvious" reversing both earlier non-final decisions.
Disk file systems | DOS on IBM PC compatibles | Microsoft Windows
FAT | File Allocation Table | FAT | FAT | جدول تخصیص فایل | File Allocation Table | FAT | File Allocation Table | File Allocation Table | FAT32 | FAT | FAT32 | File Allocation Table | FAT32 | FAT32 | FAT32 | Dosya Yerleşim Tablosu | FAT
This article is licensed under the GNU Free Documentation License.
It uses material from the
"File Allocation Table".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world