CompTIA A_ Certification All-In-One Exam Guide, Seventh Edition - Michael Meyers [183]
Figure 12-10 Cluster versus sector
Table 12-1 FAT16 Cluster Sizes
FAT16 in Action
Assume you have a copy of Windows using FAT16. When an application such as Microsoft Word tells the OS to save a file, Windows starts at the beginning of the FAT, looking for the first space marked “open for use” (0000), and begins to write to that cluster. If the entire file fits within that one cluster, Windows places the code FFFF (last cluster) into the cluster’s status area in the FAT. That’s called the end-of-file marker. Windows then goes to the folder storing the file and adds the filename and the cluster’s number to the folder list. If the file requires more than one cluster, Windows searches for the next open cluster and places the number of the next cluster in the status area, filling and adding clusters until the entire file is saved. The last cluster then receives the end-of-file marker (FFFF).
Let’s run through an example of this process, and start by selecting an arbitrary part of the FAT: from 3ABB to 3AC7. Assume you want to save a file called MOM.TXT. Before saving the file, the FAT looks like Figure 12-11.
Figure 12-11 The initial FAT
Windows finds the first open cluster, 3ABB, and fills it. But not all of the MOM.TXT file fits into that cluster. Needing more space, the OS goes through the FAT to find the next open cluster. It finds cluster 3ABC. Before filling 3ABC, the value 3ABC is placed in 3ABB’s status (see Figure 12-12).
Even after filling two clusters, more of the MOM.TXT file remains, so Windows must find one more cluster. The 3ABD has been marked FFF7 (bad cluster or bad-sector marker), so Windows skips over 3ABD, finding 3ABE (see Figure 12-13).
Before filling 3ABE, Windows enters the value 3ABE in 3ABC’s status. Windows does not completely fill 3ABE, signifying that the entire MOM.TXT file has been stored. Windows enters the value FFFF in 3ABE’s status, indicating the end of file (see Figure 12-14).
After saving all of the clusters, Windows locates the file’s folder (yes, folders also are stored on clusters, but they get a different set of clusters, somewhere else on the disk) and records the filename, size, date/time, and starting cluster, like this:
MOM.TXT 19234 05-19-09 2:04p 3ABB
Figure 12-12 The first cluster used
Figure 12-13 The second cluster used
If a program requests that file, the process is reversed. Windows locates the folder containing the file to determine the starting cluster and then pulls a piece of the file from each cluster until it sees the end-of-file cluster. Windows then hands the reassembled file to the requesting application.
Figure 12-14 End of file reached
Clearly, without the FAT, Windows cannot locate files. FAT16 automatically makes two copies of the FAT. One FAT backs up the other to provide special utilities a way to recover a FAT that gets corrupted—a painfully common occurrence.
Even when FAT works perfectly, over time the files begin to separate in a process called fragmentation.
Fragmentation
Continuing with the example, let’s use Microsoft Word to save two more files: a letter to the IRS (IRSROB.DOC) and a letter to IBM (IBMHELP.DOC). IRSROB.DOC takes the next three clusters—3ABF, 3AC0, and 3AC1—and IBMHELP.DOC takes two clusters—3AC2 and 3AC3 (see Figure 12-15).
Now suppose you erase MOM.TXT. Windows does not delete the cluster