Chapter
4
MS-DOS
DISK
ALLOCATION
The
MS-DOS
area on a diskette is formatted as follows:
First copy
of
File Allocation
Table
-
variable size
Second copy
of
File Allocation
Table
-
variable size (optional)
Additional copies
of
File Allocation
Table
-
variable size (optional)
I
File data area
I
Space
for
a
file in the data area is not pre-allocated. The space
is
allocated one cluster at a time, as needed.
A
cluster consists
of
one
or
more consecutive sectors. All
of
the clusters
for
a file are
“chained” together in the File Allocation Table (FAT).
A
second copy
of
the FAT is usually kept
for
consistency. If the
disk should develop
a
bad sector in the first FAT, the second can
be used. This prevents loss
of
data due
to
an unusable disk.
The clusters are arranged on disk
to
minimize head movement
for
multi-sided media. All
of
the space on
a
track
(or
cylinder) is
allocated before moving on to the next track. This is done by al-
locating all the sectors sequentially on the lowest-numbered
head, then all the sectors on the next head, and
so
on until all
sectors
on
all heads
of
the track are used. The next sector
to
use
will be sector
1
on head
0
of
the next track.
For diskettes, the following table can be used:
Number Sectors
FAT
size Directory Directory Sectors
of
Per in Sectors Entries per
1
8
1
4
64
1
2
8
1
7
112
2
1
9
2
4 64
1
2
9
2
7
112
2
Sides Track Sectors Cluster
165