The FSInfo Structure
The FSInfo structure can contain information to help the master computer find free clusters quickly. The structure is in the location specified in byte 48 in the BPB. The location is typically in reserved sector 1, immediately following the boot sector. Table 8-5 shows the contents of the FSInfo structure.
The Backup Boot Sector
Sectors 6–8 in the reserved region can store a backup copy of the three sectors beginning with the volume’s boot sector. The backup is for use in media repair if the original copy is damaged.
File Allocation Table Region
As with FAT16, following the reserved region are two copies of the file allocation tables (FATs). A FAT32 table has a 32-bit entry for each data cluster in the volume. The highest four bits are reserved, however. During formatting, all 32 bits of each entry are set to zero. After formatting, software that reads and writes to the FAT should preserve the contents of the four high bits.
The Flags field in the BPB specifies whether or not the FATs are mirrored. If mirroring is enabled, the file-system driver maintains two identical copies of the FAT. If any portion of the area reserved for one of the FATs becomes damaged, the value in the Flags field can disable mirroring and specify which FAT the file system should use.
Table 8-4: Recommended values for fields in a FAT32 boot sector.
File and Directory Data Region
As with FAT16, the file-and-directory data region consists of data clusters that can store files and subdirectories. In a FAT32 system, this region stores the root directory. The first data cluster is cluster 2.
Selecting a File System
Which FAT file system a volume is formatted for depends entirely on the number of data clusters in the volume. The data clusters include all of the clusters beginning with cluster 2 in the file-and-directory data region. They don’t include the MBR sector, reserved region, FAT region, or FAT16 root-directory sectors.
The FAT32 specification says that a volume with fewer than 4085 data clusters is formatted as FAT12, and a volume with 4085 to 65524 data clusters is formatted as FAT16. Valid FAT12 cluster numbers are 2 to FEFh, so the maximum number of FAT12 clusters is actually 4078. Valid FAT16 cluster numbers are 2 to FFEFh, so the maximum number of FAT16 clusters is actually 65518. A volume with 65527 or more data clusters is formatted as FAT32.
Table 8-5: The FSInfo structure contains information that can help the file-system driver find free clusters quickly.
Formatting software can select a file system by setting the cluster size so the number of clusters is in the desired range. Because some existing FAT implementations don’t calculate the number of clusters correctly, Microsoft recommends formatting all volumes to have at least 16 clusters more than the specified minimum and 16 clusters less than the specified maximum for the file system. Also note that a few values are outside the recommended ranges for any FAT file system.
Table 8-6 shows the cluster sizes Windows XP Professional uses for FAT16 and FAT32 volumes of different capacities. For maximum compatibility, volumes smaller than 16 MB should use FAT12. Windows can’t format volumes greater than 32 GB using FAT32 but can read volumes of this size if formatted in another operating system.
The FAT32 specification describes a method for calculating the number of data clusters in a volume. (It’s not as straightforward as you might think.) Embedded systems that format storage media can do the calculations, or they can just use the same cluster size as Windows for their volume size.