To read a file it is necessary to find its record in a folder by its name and to
read the number of the 1
st
file cluster. The first cluster represents the
beginning of a file. Then it is necessary to read a FAT element corresponding
to the first cluster of a file. If this element contains a «last in chain» label,
there’s no need to continue searching: this file is simply located in a single
cluster. If a cluster is not the last, it contains the number of the next cluster.
Contents of the next cluster should be read after the first. When the last
cluster in a chain is found, it is necessary to cut off the remaining bytes of
the cluster if this file does not occupy all of it. Extra bytes are cut off accord-
ing to the file length stored in the folder record.
To write a file, the operating system has to execute the following sequence of
actions: create a file description in a free folder element, search for a free
FAT element, and place the reference to it to a folder record; fill the first
cluster described by the FAT element found; and place the number of the
next cluster or an attribute of the last cluster in a chain to this FAT element.
The operating system operates in this way to add next clusters to chains
according to the increasing number. It’s clear that consistently located
clusters can be addressed much faster than if they were randomly spread
along the disk. Clusters that are already occupied or clusters marked in FAT
as defective are left out.
File deletion (from a Recycle bin that appeared in Windows 95) declares all
file clusters free (along with zeroing of corresponding FAT elements) and
replacing the first symbol of file name in the folder record by 0E5h value.
Operating system ignores such elements during a usual folder search.
3.5.2 A Folder in DiskEditor Main Window
Let us now create a very simple file on the logical partition of our hard disk.
It can be done with the help of Windows Notebook application. Name this file
test.txt, fill it with a single word «test», and save it the partition root folder.
Acronis DiskEditor 27