Information Technology Reference
In-Depth Information
The File Allocation Table
The file allocation table contains an entry for each data cluster in a volume.
In a FAT16 volume, each entry is 16 bits. In a FAT32 volume, each entry is
32 bits, with the lower 28 bits used to store a cluster number.
The First Two Entries
The first two entries in the FAT don't store cluster information. In entry
zero, the lowest byte should match the media-type byte in byte 21 in the
BPB. (The media-type byte is generally unused. To find out whether a
device has removable media, a host can send an INQUIRY command and
check the RMB bit in the response, as described in Chapter 6.) All other bits
are set to 1.
Formatting a volume sets entry 1 in a FAT16 table to a value from FFF8h to
FFFFh. The mass-storage host can set the two highest bits of the entry to
indicate error conditions. Bit 15 may be set to zero to indicate a dirty vol-
ume, which means that the system shut down or the device was removed
before all pending writes completed. Bit 14 may be set to zero to indicate
that the file system's driver had an I/O error the last time the media was
made available.
For entry 1 in a FAT32 table, bits 15..0 are the same as for FAT16, and bits
27..16 are 1s.
Data Clusters
Entry 2 in a FAT is the first entry for a data cluster. The first data cluster in
the volume is thus called cluster 2. There is no data cluster 0 or data cluster
1. The other clusters follow cluster 2 in sequence, to a maximum of FFEFh
(FAT16) or FFFFFEFh (FAT32). Table 8-7 shows the meanings of values in
FAT entries.
The series of clusters used by a file is called a cluster chain (Figure 8-2). A
file's directory entry contains the number of the file's first cluster. If a file in
a FAT16 volume requires only one cluster, the FAT entry for that cluster
contains a value from FFF8h to FFFFh. These values, called end-of-clus-
Search WWH ::




Custom Search