File Allocation Table (FAT)
Following DBR are the File Allocation Tables. The File Allocation Table (FAT) was introduced in 1977 to store data on floppy disks for Microsoft stand-alone Disk Basic. The FAT has been modified several times to accommodate expanding needs. It was developed to fulfill the requirements of a fast and flexible system for managing data on both removable and fixed media.
In 1996, the FAT32 was introduced with Windows 95 OSR2. As we have discussed earlier, Windows 98/ME supports FAT32 with the size of hard drives. Now with these operating systems the FAT32 file system is commonly used.
The first DOS FAT file system (DOS 1.x) used 12-bit FAT system which is still in use today for floppy disks. DOS 2.x added support for hard disks, shifted to 16-bit FAT entries because of larger volumes.
Around 1987, DOS 4.0 changed low-level sector-handling to use 32-bit parameters to over come the large disk support problem as we have already discussed the limitations of file systems.
FAT keeps a map of the complete surface of the disk drive such that, which area is free, which area is bad, which area is taken up by which file etc. When some data stored on the disk surface is to be accessed, the DOS consults the FAT to find out the areas of the hard disk surface that contains the data.
The type of the FAT to be used is decided by the FDISK program during the partition of the hard disk drive. But the actual FAT is written by the FORMAT program of DOS.
The FAT does not keep track of each and every sector on the disk surface instead it manages the disk area in a group of sectors called “cluster” or “allocation unit” (See the Cluster Discussed before, in the same chapter).
A cluster is the smallest unit of hard disk drive space that DOS allocates to a file, it consist of one or more sectors depending on the drive size. The cluster size is decided and fixed by the DOS FORMAT program during the high level formatting of the hard disk drive. (See the “size of clusters” discussion, given before)
Actually, the FAT is an index of the clusters of the entire volume. The FAT has one entry for each cluster. The first two entries in a FAT contain information about the FAT. The third and subsequent entries in the FAT are assigned to clusters of disk space, starting with the first cluster available for use by files.
Because FAT is such an important item, DOS keeps two copies of the FAT, primary FAT or FAT1 and secondary FAT or FAT2 (there are normally two copies, however many new operating systems create more than two copies of FAT).
Each FAT occupies contiguous sectors on the disk, with the 2nd FAT immediately following the1st FAT does not make the DOS use 2nd FAT to correct the problem, instead when the 1st FAT is updated DOS copies it to the 2nd FAT, corrupting the 2nd FAT as well, in the process.
This updating is done every time DOS finds that the 1st and 2nd FAT does not match. So, in case of any corruption of the 1st FAT, one should immediately do the repair by using some disk editor software and comparing the 1st FAT with the 2nd FAT. This should be done before DOS copies the corrupted FAT to the second FAT.
With the introduction of FAT32, both the FAT entries and the sector numbering are now 32-bit. That means that there are now 4,294,967,296 distinct 32-bit values multiplied by 512 bytes per sector yielding 2 terabytes (2,199,023,255,552 bytes) as the maximum possible disk size under FAT32.
The size of the directory entry for each file in FAT 32 is 4 bytes to contain the value of the starting cluster of the file rather than the 2 bytes needed under FAT16. The larger value accommodates the larger number of possible clusters.
Traditionally, each directory entry is a 32-byte record, and this remains the same. In the middle of the directory record there is 10 bytes (bytes 12 to 21) that Microsoft has reserved for its own future use. Two of those bytes are now used to accommodate the extra bytes needed to specify the starting cluster under FAT32.
As we have already discussed that there have been 12 bit, 16 bit, and 32 bit versions of FAT. While 32 bit FAT allows much more efficient storage which may be up to 30% more efficient and use of larger hard drives.
When the File System of an Operating System is invoked by a program to find the contents of a file, the first cluster value, in the directory entry for that file, is read and used to find the FAT chain. The FAT chain is the list of clusters that contain data belonging to a file.
|