Learn about the technologies behind the Internet with The TCP/IP Guide!|
NOTE: Using robot software to mass-download the site degrades the server and is prohibited. See here for more.
Find The PC Guide helpful? Please consider a donation to The PC Guide Tip Jar. Visa/MC/Paypal accepted.
|View over 750 of my fine art photos any time for free at DesktopScenes.com!|
File Allocation Tables
The structure that gives the FAT file system its name is the file allocation table. In order to understand what this important table does, you must first understand how space on the hard disk is allocated under operating systems that use FAT family file systems (including DOS and most versions of Windows.)
Data is stored in individual 512-byte sectors on the hard disk. In theory, it is possible for each file to be allocated to a number of individual sectors, and this is in fact done for some file systems (such as HPFS.) However, for performance reasons, individual sectors are not allocated to files in the FAT system. The reason is that it would take a lot of overhead (time and space) to keep track of pieces of files that were this small: a 10 GB disk partition has 20,000,000 sectors! The hard disk is instead broken into larger pieces called clusters, or alternatively, allocation units. Each cluster contains a number of sectors. Typically, clusters range in size from 2,048 bytes to 32,768 bytes, which corresponds to 4 to 64 sectors each. Clusters and how they work are described in full detail in this section.
The file allocation table is where information about clusters is stored. Each cluster has an entry in the FAT that describes how it used. This is what tells the operating system which parts of the disk are currently used by files, and which are free for use. The FAT entries are used by the operating system to chain together clusters to form files. This chaining process is described here.
The file allocation tables are stored in the area of the disk immediately following the volume boot sector. Each volume actually contains two identical copies of the FAT; ostensibly, the second one is meant to be a backup of sorts in case of any damage to the first copy. Damage to the FAT can of course result in data loss since this is where the record is kept of which parts of the disk contain which files. The idea behind the backup copy is that it could be used in the event that the primary becomes damaged.
In the conventional FAT system, however, the backup FAT system doesn't work too well. The problem is that the two copies are kept right next to each other on the disk, so that if, for example, bad sectors develop on the disk where the first copy of the FAT is stored, chances are pretty good that the second copy will be affected as well. Another problem is that disk utilities frequently duplicate the primary FAT to the backup FAT location. This means that any corruption that arises in the primary FAT may be duplicated to the backup copy before it is noticed.
Under FAT32, some improvements were made to the FAT backup scheme. First, either copy of the FAT can be designated the "primary" and either the "backup". Second, the method by which the FAT is copied from the primary to the backup location can be disabled. The combination of these features allows the second FAT to be protected and used in the event of problems with the first.