File Allocation Table (FAT) is the name of a computer file system architecture and a family of industry standard file systems utilizing it. The FAT file system is a simple file system originally designed for small disks and simple folder structures. The FAT file system is named for its method of organization, the file allocation table, which resides at the beginning of the volume. To protect the volume, two copies of the table are kept, in case one becomes damaged. In addition, the file allocation tables and the root folder must be stored in a fixed location so that the files needed to start the system can be correctly located. The major versions of the FAT format are named after the number of table element bits: 12 (FAT12), 16 (FAT16), and 32 (FAT32); each of these variants is still in use. The FAT standard has also been expanded in other ways while generally preserving backward compatibility with existing software. The Windows FAT file system driver is implemented in the \Windows\System32\Drivers\Fastfat.sys file.
The figure below illustrates how the FAT file system organizes a volume.
Figure 1: FAT file system volume organization.
The file allocation table contains the following types of information about each cluster on the volume
Figure 2: sample of a FAT file-allocation chain.
The root directory of FAT12 and FAT16 volumes is preassigned enough space at the start of a volume to store 256 directory entries, which places an upper limit on the number of fles and directories that can be stored in the root directory (there’s no preassigned space or size limit on FAT32 root directories ). A FAT directory entry is 32 bytes and stores a file’s name, size, starting cluster and time stamp (last-accessed, created and so on) information. If a file has a name that is Unicode or that doesn’t follow the MS-DOS 8.3 naming convention, additional directory entries are allocated to store the long fle name: the supplementary entries precede the file’s main entry. Figure 3 shows a sample directory entry for a file named “The quick brown fox.”: the system has created a THEQUI~1 FOX 8.3 representation of the name (that is, you don’t see a “.” in the directory entry because it is assumed to come after the eighth character) and used two more directory entries to store the Unicode long fle name; each row in the figure is made up of 16 bytes.
Figure 3: a FAT directory entry.
The Partition Boot Sector contains information that the file system uses to access the volume. On x86-based computers, the Master Boot Record use the Partition Boot Sector on the system partition to load the operating system kernel files. Table 1 describes the fields in the Partition Boot Sector for a volume formatted with the FAT file system.
Byte Offset
Field Length
Sample Value
Meaning
Table 1: fields in the Partition Boot Sector.
The BIOS Parameter Block, or BPB" is a structure that provides enough information for the executable portion of the boot sector to be able to locate the NTLDR file. Because the BPB always starts at the same offset, standard parameters are always in a known location. Because the first instruction in the boot sector is a jump, the BPB can be extended in the future, provided new information is appended to the end. Some additional fields follow the standard BIOS Parameter Block and constitute an "extended BIOS Parameter Block". Table 2 describes BIOS Parameter Block and Extended BIOS Parameter Block fields.
0x0B
WORD
0x0002
Bytes per Sector. The size of a hardware sector. For most disks in use in the United States, the value of this field is 512.
0x0D
BYTE
0x08
Sectors Per Cluster. The number of sectors in a cluster. The default cluster size for a volume depends on the volume size and the file system.
0x0E
0x0100
Reserved Sectors. The number of sectors from the Partition Boot Sector to the start of the first file allocation table, including the Partition Boot Sector. The minimum value is 1. If the value is greater than 1, it means that the bootstrap code is too long to fit completely in the Partition Boot Sector.
0x10
0x02
Number of file allocation tables (FATs). The number of copies of the file allocation table on the volume. Typically, the value of this field is 2.
0x11
Root Entries. The total number of file name entries that can be stored in the root folder of the volume. One entry is always used as a Volume Label. Files with long filenames use up multiple entries per file. Therefore, the largest number of files in the root folder is typically 511, but you will run out of entries sooner if you use long filenames.
0x13
0x0000
Small Sectors. The number of sectors on the volume if the number fits in 16 bits (65535). For volumes larger than 65536 sectors, this field has a value of 0 and the Large Sectors field is used instead.
0x15
0xF8
Media Type. Provides information about the media being used. A value of 0xF8 indicates a hard disk.
0x16
0xC900
Sectors per file allocation table (FAT). Number of sectors occupied by each of the file allocation tables on the volume. By using this information, together with the Number of FATs and Reserved Sectors, you can compute where the root folder begins. By using the number of entries in the root folder, you can also compute where the user data area of the volume begins.
0x18
0x3F00
Sectors per Track. The apparent disk geometry in use when the disk was low-level formatted.
0x1A
0x1000
Number of Heads. The apparent disk geometry in use when the disk was low-level formatted.
0x1C
DWORD
3F 00 00 00
Hidden Sectors. Same as the Relative Sector field in the Partition Table.
0x20
51 42 06 00
Large Sectors. If the Small Sectors field is zero, this field contains the total number of sectors in the volume. If Small Sectors is nonzero, this field contains zero..
0x24
0x80
Physical Disk Number. This is related to the BIOS physical disk number. Floppy drives are numbered starting with 0x00 for the A disk. Physical hard disks are numbered starting with 0x80. The value is typically 0x80 for hard disks, regardless of how many physical disk drives exist, because the value is only relevant if the device is the startup disk.
0x25
0x00
Current Head. Not used by the FAT file system.
0x26
0x29
Signature. Must be either 0x28 or 0x29 in order to be recognized by Windows NT.
0x27
4 bytes
CE 13 46 30
Volume Serial Number. A unique number that is created when you format the volume.
0x2B
11 bytes
NO NAME
Volume Label. This field was used to store the volume label, but the volume label is now stored as special file in the root directory.
0x36
8 bytes
FAT16
System ID. Either FAT12 or FAT16, depending on the format of the disk.
Table 2: fields in the BIOS Parameter Block and Extended BIOS Parameter Block.
The root folder contains an entry for each file and folder in the root. The only difference between the root folder and other folders is that the root folder is on a specified location on the disk and has a fixed size (512 entries for a hard disk, number of entries on a floppy disk depends on the size of the disk).
One of the user experience goals for the designers of Windows 95 was the ability to use long filenames (LFNs, up to 255 UTF-16 code points long), in addition to classic 8.3 filenames (Short File Name, SFNs). For backward compatibility, LFNs were implemented as an optional extension on top of the existing FAT file system structures using a workaround in the way directory entries are laid out. This transparent method to store long file names in the existing FAT file systems without altering their data structures is usually known as VFAT (for "Virtual FAT"), after the Windows 95 virtual device driver. In Windows NT, support for VFAT long filenames started from version 3.5. Non VFAT-enabled operating systems can still access the files under their short file name alias without restrictions; however, the associated long file names may get lost, when files with long file names are copied under non VFAT-aware operating systems.
NOTE: this section provides links that are external to the TechNet Wiki.
Richard Mueller edited Revision 11. Comment: Removed (en-US) from title, added tags
Luigi Bruno edited Revision 10. Comment: Edited the "Introduction" section.
Luigi Bruno edited Revision 9. Comment: Added some links in the "Microsoft Knowledge Base Articles" section.
Luigi Bruno edited Revision 8. Comment: Removed the "Work in progress" Wiki Message Template.
Luigi Bruno edited Revision 7. Comment: Added the "TechNet Library Pages" in the "Community Resources" section. Added the "Return to top" link at the end of each section.
Luigi Bruno edited Revision 6. Comment: Edited the "Introduction" section. Added the "Long File Names" section.
Luigi Bruno edited Revision 5. Comment: Edited the "Structure of a FAT Volume" section.
Luigi Bruno edited Revision 4. Comment: Edited the "Structure of a FAT Volume" section.
Luigi Bruno edited Revision 3. Comment: Edited Table 1 header. Added the "See Also" section.
Luigi Bruno edited Revision 2. Comment: Added the "FAT Root Folder" section.
Luigi Bruno edited Revision 1. Comment: Added the "BIOS Parameter Block and Extended BIOS Parameter Block" section.
Luigi Bruno edited Original. Comment: Added the "The Partition Boot Sector" section. Added the "Microsoft Knowledge Base Articles" list in the "Community Resources" section