File Allocation Table (FAT)
File Allocation Table (FAT) may contain 1 or 2 FATs, as defined in NumberOfFats field. ActiveFat field in VolumeFlags in the Main Boot Sector determines which FAT is active.
The first cluster is cluster 2, as in FAT32. Each FatEntry represents one cluster.
In exFAT, FAT is not used for tracking an allocation; an Allocation Bitmap is used for this purpose. FAT is only used for keeping chains of clusters of fragmented files. If a file is not fragmented, FAT table does not need to be updated. A Stream Extensions Directory Entry should be consulted to determine if the FAT chain is valid or not. If FAT chain is not valid, it does not need to be zeroed.
|0 (0x00)||4||FatEntry||Media type (should be 0xFFFFFFF8)|
|4 (0x04)||4||FatEntry||Must be 0xFFFFFFFF|
|8 (0x08)||4||FatEntry||First cluster|
|(ClusterCount + 1) * 4||4||FatEntry[ClusterCount + 1]||Last cluster|
|(ClusterCount + 2) * 4||Remainder of sector||ExcessSpace|
Valid values of FAT entries:
- 0x00000002 — ClusterCount +1 (max 0xFFFFFFF6) — next cluster in the chain
- 0xFFFFFFF7 — bad cluster
- 0xFFFFFFF8 — media descriptor
- 0xFFFFFFFF — end of file (EOF mark) Value 0x00000000 does not mean the cluster is free, it is an undefined value.
The second FAT table (presents only in TexFAT) is located immediately after the first one and has the same size.
The cluster heap is a set of clusters which hold data in exFAT. It contains:
- Root Directory
- Bitmap Allocation Table
- UP-Case Table The allocation status of clusters in cluster heap is tracked by Bitmap Allocation Table which itself located inside the cluster heap.