The following topics describe the FAT32 file system.
FAT32 is a derivative of the File Allocation Table (FAT) file system that supports drives with over 2GB of storage. Because FAT32 drives can contain more than 65,526 clusters, smaller clusters are used than on large FAT16 drives. This method results in more efficient space allocation on the FAT32 drive.
The largest possible file for a FAT32 drive is 4GB minus 2 bytes.
The FAT32 file system includes four bytes per cluster within the file allocation table.
Note that the high 4 bits of the 32-bit values in the FAT32 file allocation table are reserved and are not part of the cluster number.
Modifications | Description |
---|---|
Reserved Sectors | FAT32 drives contain more reserved sectors than FAT16 or FAT12 drives. The number of reserved sectors is usually 32, but can vary. |
Boot Sector Modifications | Because a FAT32 BIOS Parameter Block (BPB), represented by the BPB (FAT32) structure, is larger than a standard BPB, the boot record on FAT32 drives is greater than 1 sector. In addition, there is a sector in the reserved area on FAT32 drives that contains values for the count of free clusters and the cluster number of the most recently allocated cluster. These values are members of the BIGFATBOOTFSINFO (FAT32) structure which is contained within this sector. These additional fields allow the system to initialize the values without having to read the entire file allocation table. |
Root Directory | The root directory on a FAT32 drive is not stored in a fixed location as it is on FAT16 and FAT12 drives. On FAT32 drives, the root directory is an ordinary cluster chain. The A_BF_BPB_RootDirStrtClus member in the BPB structure contains the number of the first cluster in the root directory. This allows the root directory to grow as needed. In addition, the BPB_RootEntries member of BPB is ignored on a FAT32 drive. |
Sectors Per FAT | The A_BF_BPB_SectorsPerFAT member of BPB (FAT32) is always zero on a FAT32 drive. Additionally, the A_BF_BPB_BigSectorsPerFat and A_BF_BPB_BigSectorsPerFatHi members of the updated BPB provide equivalent information for FAT32 media. |
The BPB for FAT32 drives is an extended version of the FAT16/FAT12 BPB. It contains identical information to a standard BPB, but also includes several extra fields for FAT32 specific information.
This structure is implemented in Windows OEM Service Release 2 and later.
A_BF_BPB STRUC A_BF_BPB_BytesPerSector DW ? A_BF_BPB_SectorsPerCluster DB ? A_BF_BPB_ReservedSectors DW ? A_BF_BPB_NumberOfFATs DB ? A_BF_BPB_RootEntries DW ? A_BF_BPB_TotalSectors DW ? A_BF_BPB_MediaDescriptor DB ? A_BF_BPB_SectorsPerFAT DW ? A_BF_BPB_SectorsPerTrack DW ? A_BF_BPB_Heads DW ? A_BF_BPB_HiddenSectors DW ? A_BF_BPB_HiddenSectorsHigh DW ? A_BF_BPB_BigTotalSectors DW ? A_BF_BPB_BigTotalSectorsHigh DW ? A_BF_BPB_BigSectorsPerFat DW ? A_BF_BPB_BigSectorsPerFatHi DW ? A_BF_BPB_ExtFlags DW ? A_BF_BPB_FS_Version DW ? A_BF_BPB_RootDirStrtClus DW ? A_BF_BPB_RootDirStrtClusHi DW ? A_BF_BPB_FSInfoSec DW ? A_BF_BPB_BkUpBootSec DW ? A_BF_BPB_Reserved DW 6 DUP (?) A_BF_BPB ENDS
The number of bytes per sector.
The number of sectors per cluster.
The number of reserved sectors, beginning with sector 0.
The number of File Allocation Tables.
This member is ignored on FAT32 drives.
The size of the partition, in sectors.
The media descriptor. Values in this member are identical to standard BPB.
The number of sectors per FAT.
Note: This member will always be zero in a FAT32 BPB. Use the values from A_BF_BPB_BigSectorsPerFat and A_BF_BPB_BigSectorsPerFatHi for FAT32 media.
The number of sectors per track.
The number of read/write heads on the drive.
The number of hidden sectors on the drive.
The high word of the hidden sectors value.
The total number of sectors on the FAT32 drive.
The high word of the FAT32 total sectors value.
The number of sectors per FAT on the FAT32 drive.
The high word of the FAT32 sectors per FAT value.
Flags describing the drive. Bit 8 of this value indicates whether or not information written to the active FAT will be written to all copies of the FAT. The low 4 bits of this value contain the 0-based FAT number of the Active FAT, but are only meaningful if bit 8 is set. This member can contain a combination of the following values.
Value | Description |
---|---|
BGBPB_F_ActiveFATMsk (000Fh) | Mask for low four bits. |
BGBPB_F_NoFATMirror (0080h) | Mask indicating FAT mirroring state. If set, FAT mirroring is disabled. If clear, FAT mirroring is enabled. |
* Bits 4-6 and 8-15 are reserved.
The file system version number of the FAT32 drive. The high byte represents the major version, and the low byte represents the minor version.
The cluster number of the first cluster in the FAT32 drive's root directory.
The high word of the FAT32 starting cluster number.
The sector number of the file system information sector. The file system info sector contains a BIGFATBOOTFSINFO (FAT32) structure. This member is set to 0FFFFh if there is no FSINFO sector. Otherwise, this value must be non-zero and less than the reserved sector count.
The sector number of the backup boot sector. This member is set to 0FFFFh if there is no backup boot sector. Otherwise, this value must be non-zero and less than the reserved sector count.
Reserved member.
Contains information about the file system on a FAT32 volume. This structure is implemented in Windows OEM Service Release 2 and later.
BIGFATBOOTFSINFO STRUC bfFSInf_Sig DD ? bfFSInf_free_clus_cnt DD ? bfFSInf_next_free_clus DD ? bfFSInf_resvd DD 3 DUP (?) BIGFATBOOTFSINFO ENDS
The signature of the file system information sector. The value in this member is FSINFOSIG (0x61417272L).
The count of free clusters on the drive. Set to -1 when the count is unknown.
The cluster number of the cluster that was most recently allocated.
Reserved member.
On all FAT drives, there may be multiple copies of the FAT. If an error occurs reading the primary copy, the file system will attempt to read from the backup copies. On FAT16 and FAT12 drives, the first FAT is always the primary copy and any modifications will automatically be written to all copies. However, on FAT32 drives, FAT mirroring can be disabled and a FAT other than the first one can be the primary (or "active") copy of the FAT.
Mirroring is enabled by clearing bit 0x0080 in the extdpb_flags member of a FAT32 Drive Parameter Block (DPB) structure, DPB (FAT32).
Mirroring | Description |
---|---|
When Enabled (bit 0x0080 clear) |
With mirroring enabled, whenever a FAT sector is written, it will also be written to every other FAT. Also, a mirrored FAT sector can be read from any FAT. A FAT32 drive with multiple FATs will behave the same as FAT16 and FAT12 drives with multiple FATs. That is, the multiple FATs are backups of each other. |
When Disabled (bit 0x0080 set) | With mirroring disabled, only one of the FATs is active. The active FAT is the one specified by bits 0 through 3 of the extdpb_flags member of DPB (FAT32). The other FATs are ignored. Disabling mirroring allows better handling of a drive with a bad sector in one of the FATs. If a bad sector exists, access to the damaged FAT can be completely disabled. Then, a new FAT can be built in one of the inactive FATs and then made accessible by changing the active FAT value in extdpb_flags. |
The DPB was extended to include FAT32 information. Changes are effective for Windows 95 OEM Service Release 2 and later.
DPB STRUC dpb_drive DB ? dpb_unit DB ? dpb_sector_size DW ? dpb_cluster_mask DB ? dpb_cluster_shift DB ? dpb_first_fat DW ? dpb_fat_count DB ? dpb_root_entries DW ? dpb_first_sector DW ? dpb_max_cluster DW ? dpb_fat_size DW ? dpb_dir_sector DW ? dpb_reserved2 DD ? dpb_media DB ? ifdef NOTFAT32 dpb_first_access DB ? else dpb_reserved DB ? endif dpb_reserved3 DD ? dpb_next_free DW ? dpb_free_cnt DW ? ifndef NOTFAT32 extdpb_free_cnt_hi DW ? extdpb_flags DW ? extdpb_FSInfoSec DW ? extdpb_BkUpBootSec DW ? extdpb_first_sector DD ? extdpb_max_cluster DD ? extdpb_fat_size DD ? extdpb_root_clus DD ? extdpb_next_free DD ? endif DPB ENDS
The drive number (0 = A, 1 = B, and so on).
Specifies the unit number. The device driver uses the unit number to distinguish the specified drive from the other drives it supports.
The size of each sector, in bytes.
The number of sectors per cluster minus 1.
The number of sectors per cluster, expressed as a power of 2.
The sector number of the first sector containing the file allocation table (FAT).
The number of FATs on the drive.
The number of entries in the root directory.
The sector number of the first sector in the first cluster.
The number of clusters on the drive plus 1. This member is undefined for FAT32 drives.
The number of sectors occupied by each FAT. The value of zero indicates a FAT32 drive. Use the value in extdpb_fat_sizeinstead.
The sector number of the first sector containing the root directory. This member is undefined for FAT32 drives.
Reserved member. Do not use.
Specifies the media descriptor for the medium in the specified drive.
Reserved member. Do not use.
Indicates whether the medium in the drive has been accessed. This member is initialized to -1 to force a media check the first time this DPB is used.
Reserved member. Do not use.
The cluster number of the most recently allocated cluster.
The number of free clusters on the medium. This member is 0FFFFh if the number is unknown.
The high word of free count.
Flags describing the drive. The low 4 bits of this value contain the 0-based FAT number of the Active FAT. This member can contain a combination of the following values.
Value | Description |
---|---|
BGBPB_F_ActiveFATMsk (000Fh) | Mask for low four bits. |
BGBPB_F_NoFATMirror (0080h) | Do not mirror active FAT to inactive FATs. |
Bits 4-6 and 8-15 are reserved.
The sector number of the file system information sector. This member is set to 0FFFFh if there is no FSINFO sector. Otherwise, this value must be non-zero and less than the reserved sector count.
The sector number of the backup boot sector. This member is set to 0FFFFh if there is no backup boot sector. Otherwise, this value must be non-zero and less than the reserved sector count.
The first sector of the first cluster.
The number of clusters on the drive plus 1.
The number of sectors occupied by the FAT.
The cluster number of the first cluster in the root directory.
The number of the cluster that was most recently allocated.
The following are all the valid partition types and their corresponding values for use in the Part_FileSystem member of the s_partition (FAT32) structure.
Value | Description |
---|---|
PART_UNKNOWN (00h) | Unknown |
PART_DOS2_FAT (01h) | 12-bit FAT |
PART_DOS3_FAT (04h) | 16-bit FAT. Partitions smaller than 32MB. |
PART_EXTENDED (05h) | Extended MS-DOS Partition |
PART_DOS4_FAT (06h) | 16-bit FAT. Partitions larger than or equal to 32MB. |
PART_DOS32 (0Bh) | 32-bit FAT. Partitions up to 2047GB. |
PART_DOS32X (0Ch) | Same as PART_DOS32 (0Bh), but uses Logical Block Address Int 13h extensions. |
PART_DOSX13 (0Eh) | Same as PART_DOS4_FAT (06h), but uses Logical Block Address Int 13h extensions. |
PART_DOSX13X (0Fh) | Same as PART_EXTENDED (05h), but uses Logical Block Address Int 13h extensions. |
s_partition STRUC Part_BootInd DB ? Part_FirstHead DB ? Part_FirstSector DB ? Part_FirstTrack DB ? Part_FileSystem DB ? Part_LastHead DB ? Part_LastSector DB ? Part_LastTrack DB ? Part_StartSector DD ? Part_NumSectors DD ? s_partition ENDS
Specifies whether the partition is bootable or not. This value could be set to PART_BOOTABLE (80h), or PART_NON_BOOTABLE(00h). The first partition designated as PART_BOOTABLE is the boot partition. All others are not. Setting multiple partitions to PART_BOOTABLE will result in boot errors.
The first head of this partition. This is a 0-based number representing the offset from the beginning of the disk. The partition includes this head.
The first sector of this partition. This is a 1-based, 6-bit number representing the offset from the beginning of the disk. The partition includes this sector. Bits 0 through 5 specify the 6-bit value; bits 6 and 7 are used with the Part_FirstTrack member.
The first track of this partition. This is an inclusive 0-based, 10-bit number that represents the offset from the beginning of the disk. The high 2 bits of this value are specified by bits 6 and 7 of the Part_FirstSector member.
Specifies the file system for the partition.
Value | Description |
---|---|
PART_UNKNOWN(00h) | Unknown. |
PART_DOS2_FAT(01h) | 12-bit FAT. |
PART_DOS3_FAT(04h) | 16-bit FAT. Partition smaller than 32MB. |
PART_EXTENDED(05h) | Extended MS-DOS Partition. |
PART_DOS4_FAT(06h) | 16-bit FAT. Partition larger than or equal to 32MB. |
PART_DOS32(0Bh) | 32-bit FAT. Partition up to 2047GB. |
PART_DOS32X(0Ch) | Same as PART_DOS32(0Bh), but uses Logical Block Address Int 13h extensions. |
PART_DOSX13(0Eh) | Same as PART_DOS4_FAT(06h), but uses Logical Block Address Int 13h extensions. |
PART_DOSX13X(0Fh) | Same as PART_EXTENDED(05h), but uses Logical Block Address Int 13h extensions. |
The last head of the partition. This is a 0-based number that represents the offset from the beginning of the disk. The partition includes the head specified by this member.
The last sector of this partition. This is a 1-based, 6-bit number representing offset from the beginning of the disk. The partition includes the sector specified by this member. Bits 0 through 5 specify the 6-bit value; bits 6 and 7 are used with the Part_LastTrack member.
The last track of this partition. This is a 0-based, 10-bit number that represents offset from the beginning of the disk. The partition includes this track. The high 2 bits of this value are specified by bits 6 and 7 of the Part_LastSector member.
Specifies the 1-based number of the first sector on the disk. This value may not be accurate for extended partitions. Use the Part_FirstSector value for extended partitions.
The 1-based number of sectors in the partition.
Values for head and track are 0-based. Sector values are 1-based. This structure is implemented in Windows OEM Service Release 2 and later.