Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10040141004014 Organization of the File Allocation Table Anchor10040151004015The File Allocation Table is a map of all the clusters that make up the data area of the volume. The FAT does not “know” the location of the first cluster that has been allocated to a given file. It does not even know the name of any files. That information is stored in the directory. Anchor10040161004016

As described in the section above, the directory entry for each file contains a value called a cluster address. This is a pointer to the first entry in the File Allocation Table for a given file. This FAT entry in turn points to the first cluster in the volume’s data area that has been allocated to the file.anchor10040171004017

If the file has been allocated more than one cluster, then the FAT table entry will contain the address of the second cluster (which is also the index number of the second cluster’s entry in the FAT table). The second cluster entry points to the third, and so forth. A FAT entry like this forms a linked list commonly called a cluster chain.

Anchor10040211004021 Figure 10-3 Figure - File Allocation Table and Directory Entry relationship illustrates the relationship between the directory entry and the FAT.anchor

Panel

...

borderWidth

...

0

...

titleFigure - File Allocation Table and Directory Entry relationship

Image Added


In the figure above, the directory entry for a file points to the 40th entry in the FAT table. The 40th entry points to the 41st, the 41st to the 46th; the 46th is not a pointer, as the entry contains a special end-of-cluster-chain marker. The This means that for Figure 10-3, the 41st cluster is the final cluster allocated to the file.

Anchor10040401004040Other entries in the FAT area in illustrated Figure 10-3 illustrated in the figure above are either not allocated to a file, or allocated to a file whose cluster chain is terminated by the 43rd entry. Anchor

10040411004041To summarize, a cluster’s entry in the File Allocation Table typically contains a pointer to the entry for the next cluster in a file’s cluster chain. Anchor10040421004042

Other values that can be stored in a cluster’s entry in the FAT are special markers for: Anchor10040431004043

  • End-of-cluster-chain: this cluster is the final cluster for a file.

...

...

  • Cluster-not-allocated (free cluster mark): no file is using this cluster.

...

  • Damaged-cluster: this cluster cannot be used.

...

10040461004046NOTE: Updating the FAT table is time consuming, but updating it frequently is very important. If the FAT table gets out of sync with its files, files and directories can become corrupted, resulting in the loss of data (see section 10-6 “Optional Journaling System” on page 127 Optional Journaling System).