CVF Region: FAT
The FAT is a variable-length region formatted as a File Allocation Table.
It is located a variable number of sectors after the end of the
BootSect region; its location can be calculated as
MdBpbRec.wResSects+wMdResSects sectors from the start of the CVF.
It may be formatted as a 12-bit FAT or a 16-bit FAT.
12-bit: Used for volumes less than 32 MB of uncompressed data (this
includes compressed diskettes). A 12-bit FAT uses 1½-bytes-per-
entry and 0ff7h-0fffh have special meaning, so it maxes out at
4086 clusters.
16-bit: Used for volumes greater than 4086 clusters (32 MB). A 16-bit
FAT can handle up 65526 16K clusters or 512K of uncompressed data
(same as the DoubleSpace max volume size).
See File Allocation Table for details.
The "cluster numbers" contained in this FAT are actually used as indirect
pointers into the MDFAT, rather than actual disk locations.
See Mapping DOS FAT to MDFAT for a full discussion.
One interesting note: COMMAND.COM accesses both the FAT and the MDFAT when
you use Dir /c. In order to obtain the initial FAT entry, it uses the (I
thought) long-obsolete fn 11H (find first file via FCB). The advantage of
this over fn 4eH is that it returns a raw directory entry, and therefore
supplies a pointer into the FAT.
█▌Virtual 2nd FAT▐█
Since the beginning of time, all DOS disks have contained two copies
(presumably with the idea of data integrity and recovery).
However, DoubleSpace maintains a single FAT for the volume. Since some
disk utilities rely on finding the second copy directly after the first,
DoubleSpace simulates or "virtualizes" the second FAT. Requests to read
from those "second FAT" sectors are served up data from the first (only)
FAT and attempted writes to the second FAT are sent to the "first" FAT.
█▌Standard (FAT) Undelete Operations▐█
When DOS or a utility writes to the FAT, DoubleSpace compares the old FAT
to the modified FAT and, based on the changes (and the isUsed bit in the
MdFatEntryRec), it can infer one of the following operations:
DOS allocated a cluster:
isUsed=0 and FAT entry went from 0 to any
DOS or utility freed a cluster (e.g., a DoubleSpace-unaware defragger):
isUsed=1 and FAT entry went from any to 0
Utility resurrected a cluster (e.g. Undelete):
isUsed=0 and FAT entry went from 0 to any
Depending upon the inference, DoubleSpace can then take action to rectify
and propagate the changes through the MDFAT and the BitFAT.
See Also: CVF Layout
DoubleSpace Overview
DoubleSpace API
DOS Functions
-♦-