Currently there are three FAT file system types: FAT12, FAT16 and FAT32. The basic difference in these FAT
sub types, and the reason for the names, is the size, in bits, of the entries in the actual FAT
structure on the disk. There are 12 bits in a FAT12 FAT entry, 16 bits in a FAT16 FAT entry
and 32 bits in a FAT32 FAT entry.
Contents
Notational Conventions in this Document................................................................................. 6
General Comments (Applicable to FAT File System All Types)............................................... 6
Boot Sector and BPB ................................................................................................................ 6
FAT Data Structure ................................................................................................................. 12
FAT Type Determination......................................................................................................... 13
FAT Volume Initialization ........................................................................................................ 18
FAT32 FSInfo Sector Structure and Backup Boot Sector ...................................................... 20
FAT Directory Structure .......................................................................................................... 21
Other Notes Relating to FAT Directories ................................................................................ 24
Specification Compliance........................................................................................................ 25
Notational Conventions in this Document
Numbers that have the characters “0x” at the beginning of them are hexadecimal (base 16) numbers.
Any numbers that do not have the characters “0x” at the beginning are decimal (base 10) numbers.
The code fragments in this document are written in the ‘C’ programming language. Strict typing and
syntax are not adhered to.
There are several code fragments in this document that freely mix 32-bit and 16-bit data elements. It is
assumed that you are a programmer who understands how to properly type such operations so that
data is not lost due to truncation of 32-bit values to 16-bit values. Also take note that all data types are
UNSIGNED. Do not do FAT computations with signed integer types, because the computations will
be wrong on some FAT volumes.
General Comments (Applicable to FAT File System All Types)
All of the FAT file systems were originally developed for the IBM PC machine architecture. The
importance of this is that FAT file system on disk data structure is all “little endian.” If we look at one
32-bit FAT entry stored on disk as a series of four 8-bit bytes—the first being byte[0] and the last
being byte[4]—here is where the 32 bits numbered 00 through 31 are (00 being the least significant
bit):
byte[3] 3 3 2 2 2 2 2 2
1 0 9 8 7 6 5 4
byte[2] 2 2 2 2 1 1 1 1
3 2 1 0 9 8 7 6
byte[1] 1 1 1 1 1 1 0 0
5 4 3 2 1 0 9 8
byte[0] 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
This is important if your machine is a “big endian” machine, because you will have to translate
between big and little endian as you move data to and from the disk.
A FAT file system volume is composed of four basic regions, which are laid out in this order on the
volume:
0 – Reserved Region
1 – FAT Region
2 – Root Directory Region (doesn’t exist on FAT32 volumes)
3 – File and Directory Data Region
Boot Sector and BPB
The first important data structure on a FAT volume is called the BPB (BIOS Parameter Block), which
is located in the first sector of the volume in the Reserved Region. This sector is sometimes called the
“boot sector” or the “reserved sector” or the “0th sector,” but the important fact is simply that it is the
first sector of the volume.
This is the first thing about the FAT file system that sometimes causes confusion. In MS-DOS version
1.x, there was not a BPB in the boot sector. In this first version of the FAT file system, there were
only two different formats, the one for single-sided and the one for double-sided 360K 5.25-inchfloppy disks. The determination of which type was on the disk was done by looking at the first byte of
the FAT (the low 8 bits of FAT[0]).
This type of media determination was superseded in MS-DOS version 2.x by putting a BPB in the
boot sector, and the old style of media determination (done by looking at the first byte of the FAT)
was no longer supported. All FAT volumes must have a BPB in the boot sector.
This brings us to the second point of confusion relating to FAT volume determination: What exactly
does a BPB look like? The BPB in the boot sector defined for MS-DOS 2.x only allowed for a FAT
volume with strictly less than 65,536 sectors (32 MB worth of 512-byte sectors). This limitation was
due to the fact that the “total sectors” field was only a 16-bit field. This limitation was addressed by
MS-DOS 3.x, where the BPB was modified to include a new 32-bit field for the total sectors value.
The next BPB change occurred with the Microsoft Windows 95 operating system, where the FAT32
type was introduced. FAT16 was limited by the maximum size of the FAT and the maximum valid
cluster size to no more than a 2 GB volume if the disk had 512-byte sectors. FAT32 addressed this
limitation on the amount of disk space that one FAT volume could occupy so that disks larger than
2 GB only had to have one partition defined.
The FAT32 BPB exactly matches the FAT12/FAT16 BPB up to and including the BPB_TotSec32
field. They differ starting at offset 36, depending on whether the media type is FAT12/FAT16 or
FAT32 (see discussion below for determining FAT type). The relevant point here is that the BPB in
the boot sector of a FAT volume should always be one that has all of the new BPB fields for either the
FAT12/FAT16 or FAT32 BPB type. Doing it this way ensures the maximum compatibility of the FAT
volume and ensures that all FAT file system drivers will understand and support the volume properly,
because it always contains all of the currently defined fields.
NOTE: In the following description, all the fields whose names start with BPB_ are part of the BPB.
All the fields whose names start with BS_ are part of the boot sector and not really part of the BPB.
The following shows the start of sector 0 of a FAT volume, which contains the BPB