6. File Allocation Table (2)
Files are stored in one or more clusters. These clusters are unlikely to be next to each other because of the way files are allocated space. So a file could be scattered all over a hard disk. Each file is made up of a series of clusters called a 'chain'.
The File Allocation Table keeps track of these chains.
A File Allocation Table is a data table stored on the hard disk, containing a number of records. Each record is describing details about each cluster.
- The cluster number of the next cluster in a chain
- A flag to indicate this is the last cluster in a chain
- A flag to indicate that this is a 'bad' cluster i.e. unusable
- A flag to indicate that this is a 'reserved' cluster and so is not available to store files
- A flag to indicate that this cluster is free
So the FAT is keeping a record of every cluster on the hard disk. Each record points to another record so a chain can be traversed.
Note that the FAT does not store the location of the first cluster of the file. This is the job of another table called the 'Directory Table'.
Each entry in a Directory Table provides details of every file within that directory (folder)
This detail includes:
- The starting cluster of the file (e.g. cluster number 30003)
- File name
- File extension (.doc .txt and so on)
- File Attribute (hidden, system, archive, directory, read-only, volume)
- Date of creation
- File size
So the file manager (such as Windows Explorer) will first of all look to the directory table for the starting cluster, then to the File Allocation Table to find out where all of the other clusters that contain the file are located..
For example, this is how files are read from disk. The file manager will have the location of the first cluster, then it follows the trail of clusters through the file allocation table until the last one is read.
Copyright © www.teach-ict.com