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.
|
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]