Data Recovery Concept

FAT32 Features

The following topics describe the FAT32 file system.

File System Specifications

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.

Boot Sector and Bootstrap Modifications

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.

BPB (FAT32)

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

Values

A_BF_BPB_BytesPerSector
The number of bytes per sector.
A_BF_BPB_SectorsPerCluster
The number of sectors per cluster.
A_BF_BPB_ReservedSectors
The number of reserved sectors, beginning with sector 0.
A_BF_BPB_NumberOfFATs
The number of File Allocation Tables.
A_BF_BPB_RootEntries
This member is ignored on FAT32 drives.
A_BF_BPB_TotalSectors
The size of the partition, in sectors.
A_BF_BPB_MediaDescriptor
The media descriptor. Values in this member are identical to standard BPB.
A_BF_BPB_SectorsPerFAT
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.

A_BF_BPB_SectorsPerTrack
The number of sectors per track.
A_BF_BPB_Heads
The number of read/write heads on the drive.
A_BF_BPB_HiddenSectors
The number of hidden sectors on the drive.
A_BF_BPB_HiddenSectorsHigh
The high word of the hidden sectors value.
A_BF_BPB_BigTotalSectors
The total number of sectors on the FAT32 drive.
A_BF_BPB_BigTotalSectorsHigh
The high word of the FAT32 total sectors value.
A_BF_BPB_BigSectorsPerFat
The number of sectors per FAT on the FAT32 drive.
A_BF_BPB_BigSectorsPerFatHi
The high word of the FAT32 sectors per FAT value.
A_BF_BPBExtFlags

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.

A_BF_BPB_FS_Version
The file system version number of the FAT32 drive. The high byte represents the major version, and the low byte represents the minor version.
A_BF_BPB_RootDirStrtClus
The cluster number of the first cluster in the FAT32 drive's root directory.
A_BF_BPB_RootDirStrtClusHi
The high word of the FAT32 starting cluster number.
A_BF_BPB_FSInfoSec
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.
A_BF_BPB_BkUpBootSec
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.
A_BF_BPB_Reserved
Reserved member.

BIGFATBOOTFSINFO (FAT32)

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

Values

bfFSInf_Sig
The signature of the file system information sector. The value in this member is FSINFOSIG (0x61417272L).
bfFSInf_free_clus_cnt
The count of free clusters on the drive. Set to -1 when the count is unknown.
bfFSInf_next_free_clus
The cluster number of the cluster that was most recently allocated.
bfFSInf_resvd
Reserved member.

FAT Mirroring

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.

DPB (FAT32)

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

Values

dpb_drive
The drive number (0 = A, 1 = B, and so on).
dpb_unit
Specifies the unit number. The device driver uses the unit number to distinguish the specified drive from the other drives it supports.
dpb_sector_size
The size of each sector, in bytes.
dpb_cluster_mask
The number of sectors per cluster minus 1.
dpb_cluster_shift
The number of sectors per cluster, expressed as a power of 2.
dpb_first_fat
The sector number of the first sector containing the file allocation table (FAT).
dpb_fat_count
The number of FATs on the drive.
dpb_root_entries
The number of entries in the root directory.
dpb_first_sector
The sector number of the first sector in the first cluster.
dpb_max_cluster
The number of clusters on the drive plus 1. This member is undefined for FAT32 drives.
dpb_fat_size
The number of sectors occupied by each FAT. The value of zero indicates a FAT32 drive. Use the value in extdpb_fat_size instead.
dpb_dir_sector
The sector number of the first sector containing the root directory. This member is undefined for FAT32 drives.
dpb_reserved2
Reserved member. Do not use.
dpb_media
Specifies the media descriptor for the medium in the specified drive.
reserved
Reserved member. Do not use.
dpb_first_access
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.
dpb_reserved3
Reserved member. Do not use.
dpb_next_free
The cluster number of the most recently allocated cluster.
dpb_free_cnt
The number of free clusters on the medium. This member is 0FFFFh if the number is unknown.
extdpb_free_cnt_hi
The high word of free count.
extdpb_flags

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.

extdpb_FSInfoSec
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.
extdpb_BkUpBootSec
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.
extdpb_first_sector
The first sector of the first cluster.
extdpb_max_cluster
The number of clusters on the drive plus 1.
extdpb_fat_size
The number of sectors occupied by the FAT.
extdpb_root_clus
The cluster number of the first cluster in the root directory.
extdpb_next_free
The number of the cluster that was most recently allocated.

Partition Types

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.

Partition Types
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 (FAT32)

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

Values

Part_BootInd
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.
Part_FirstHead
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.
Part_FirstSector
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.
Part_FirstTrack
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.
PartFileSystem
Specifies the file system for the partition.
Acceptable values
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.
Part_LastHead
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.
Part_LastSector
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.
Part_LastTrack
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.
Part_StartSector
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.
Part_NumSectors
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.

Active@ UNDELETEDownload NowBuy Now
Intel Software PartnerWindows 7 Compatible