next up previous contents
Next: Cluster Sizes Up: FAT Previous: Boot Sector

File Allocation Table

Disk allocation is done in groups of sectors. Each group is called a cluster. [Pro93] At least one cluster is allocated to a file. Each sector is always 512 bytes, but the number of sectors in a cluster varies. On small disks, such as a floppy disk, a cluster may be only one sector. On large disks, a cluster may consist of as many as eight sectors. [Som91]

A disadvantage with this scheme is that only entire clusters can be allocated. This means that if you have a disk with a cluster size of eight sectors, one or more clusters will always be allocated to a file even if the file is only 50 bytes in size. Therefore, a lot of disk space can get wasted. [Pro95]

The File Allocation Table (FAT) shows which clusters are in use. The size of the FAT depends on the size of the disk. The FAT has one 12-bit or 16-bit entry for each cluster on the disk. Thus the larger the disk, the larger the FAT. [Pro93] The values that may appear in a FAT entry are shown in Table 5.1.

Table: FAT Entry Values [HF94]
12-bit FAT 16-bit FAT Meaning
0 0 Cluster not in use
0xFF0-0xFF6 0xFFF0-0xFFF6 Reserved cluster
0xFF7 0xFFF7 Bad (unusable) cluster
0xFF8-0xFFF 0xFFF8-0xFFFF Last cluster in the file
All other values All other values Link to next cluster in file

There are two identical copies of the FAT on each disk. Both copies are updated when a file is created, deleted, or changed. The second copy is a backup. If the first becomes corrupt, the second copy will be used to find the files on the disk. [Som91]

Bad clusters are found when the disk is originally logically formatted and during normal operation by running a special program to find bad clusters and mark them by writing a special value shown in Table 5.1 to the FAT entry for that cluster. [SG94]

next up previous contents
Next: Cluster Sizes Up: FAT Previous: Boot Sector
Barnett Hsu