Table of Contents
Introduction
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.
Structure of a FAT Volume
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
- unused (0x0000);
- cluster in use by a file;
- bad cluster (0xFFF7);
- last cluster in a file (0xFF8-0xFFF for FAT12; 0xFFF8-0xFFFF for FAT16; 0xFFFFFF8-0xFFFFFFFF for FAT32).
The entries in the file allocation table define the file-allocation chains (shown in Figure 2) for files and directories: the links in the chain are indexes to the next cluster of a file’s data. A file’s directory entry stores the starting cluster of the file, the last entry of the file’s allocation chain is the reserved value of 0xFFFF for FAT16 and 0xFFF for FAT12; the FAT entries for unused clusters have a value of 0. As you can see in Figure 2, FILE1 is assigned clusters 2, 3, and 4; FILE2 is fragmented and uses clusters 5, 6, and 8, while FILE3 uses only cluster 7. Reading a file from a FAT volume can involve reading large portions of a file allocation table to traverse the file’s allocation chains.
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.
↑ Return to topThe Partition Boot Sector
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 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00 | 3 bytes | EB 3C 90 | Jump instruction | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
03 | 8 bytes | MSDOS5.0 | OEM Name in text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0B | 25 bytes | &nbry.
↑ Return to topThe Partition Boot SectorThe 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.
Table 1: fields in the Partition Boot Sector. ↑ Return to topBIOS Parameter Block and Extended BIOS Parameter BlockThe 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.
Table 2: fields in the BIOS Parameter Block and Extended BIOS Parameter Block. ↑ Return to topVolume 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 |
FAT Root Folder
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). ↑ Return to topLong File NamesOne 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. ↑ Return to topCommunity ResourcesWiki PagesTechNet Library PagesMicrosoft Knowledge Base Articles
See AlsoNOTE: this section provides links that are external to the TechNet Wiki. Books
|