FM User's Guide
Version 3.2, June 2, 1987
Copyright (c) 1987 by Thomas Stepka
7702 Lunceford Lane
Falls Church, Va 22043
All rights reserved
1. Intended Audience
FM stands for FAT Manager, and FAT in turn stands for File
Allocation Table. The FAT is a data structure put on every disk
by DOS during formatting, and it keeps track of which sectors of
the disk are allocated to each file in the directory. If you
don't already know what a FAT or a cluster or a logical sector or
a cluster chain is, then you don't need this program.
2. Functions and Features
FM was written to plug a functionality hole in existing
utility software. I have often noticed DOS doing several retries
when trying to read a disk file, or even returning an I/O error;
but whenever I ran FORMAT or the Norton Utility DISKTEST, all
clusters would check out OK. I wanted a way to arbitrarily mark
areas of the disk off limits to I/O, and to restore those areas
at any future time if I so wished. FM is the result.
Following are the basic functions and features of FM:
a. List all clusters on the target disk by type (bad,
occupied or unused), with corresponding logical sector
b. Display the status of a cluster or sector, including
which file or subdirectory (if any) occupies it.
c. Enter numbers and display results in either decimal, hex,
d. Make unused clusters bad or reserved, so DOS will not use
e. Make bad or reserved clusters good, available for use
f. List all changes made to the FAT during a session.
2. FM Design Philosophy
Since the FAT is such a crucial data structure, FM takes
precautions to ensure the file structure on the target disk is
not corrupted. Specifically:
The B, G and R commands to change the status of a cluster
always give unambiguous feedback showing the results of the
FM will not allow you to change the status of a cluster that
is occupied by file or subdirectory.
The C command shows a history of all changes since running
FM, so you can't forget what you have done.
FM copies the FAT of the target disk into memory and works
with the memory copy. It writes the FAT back to disk only when
you quit, and only if you give final approval. You can also
abort FM with control-c without changing the disk FAT.
3. One Word Of Caution
FM is not an every day utility - it is more a last resort.
FM performs a function normally thought to be left to DOS only.
Certainly, DOS assumes no applications program would ever change
the FAT in any way. Therefore, FM must be used realizing this,
and with a certain amount of caution as discussed below.
Do not run FM while on a network or in any situation where a
new file could be created on disk while FM is running. Either
remove or make sure you don't use any memory resident utilities
which can create a new file on the target disk (eg the Sidekick
FM reads the FAT only once at startup, and then works with a
memory copy of it. Thus, it cannot detect a new file created on
the target disk while it is running. So, if you tell FM to write
a new FAT at the end of a session, any new file will still be in
its directory, but its allocated clusters will be overwritten.
You will then find it difficult or impossible to read or copy
this file. This will only affect your new file, however, and
running CHKDSK/F will make things right again.
FM has one insecurity, because the C, F, and L commands
allow you to redirect their output to a disk file. If you
redirect output to the target disk you be in the situation
described above. Again, CHKDSK/F will fix the problem.
Finally, if you change the FAT and write a new one to a hard
disk, reboot DOS after exiting FM. This is because DOS keeps
part of the FAT in its own memory, and doesn't know the FAT has
been changed. Therefore, if you don't reboot DOS may allocate
disk space based on its outdated information about the FAT.
4. Running FM
FM runs on IBM-PC's AT's and clones using MS-DOS v 2.0 and
later. To run, FM requires anywhere from 66K of RAM (for a 360K
floppy) up to 160K (for a 30MB hard disk). Up to 2000 files may
exist on the disk, and as many as 100 subdirectories. FM may not
work on some disks formatted by DOS v 1.x.
Run CHKDSK/F on the target disk to remove orphaned clusters.
This is recommended but not necessary.
At the DOS prompt, type FM [d]. [d] is an optional drive
specifier; if you don't specify the drive, FM will type brief
Once started, FM will read the boot sector to get basic
information about the structure of the disk. Disks formatted by
DOS v 1 have a different boot sector format from those formatted
by DOS v 2 and later; FM will not work with v1 disks.
FM then reads all copies of the FAT (typically there are
two). FM will compare all copies with each other, checking for
differences; if the copies are different FM will inform you and
ask your permission to assume the first FAT copy is the good one.
If you have been using the disk with no problems, just say yes,
and FM will then overwrite the bad copy with the good one at quit
(see Q command below) time.
Finally, FM reads the entire directory structure on the disk
and notes the name of the file occupying each cluster of the
5. FM Commands
Once up and running FM accepts the following commands.
SPECIFYING CLUSTERS AND SECTORS
When you want to examine or change a cluster, FM gives you the
option of specifying either the cluster, or any of the logical
sectors that make up the cluster. To specify a cluster type 'C'
followed by the cluster number, no intervening spaces. To
specify a logical sector type 'S' followed by the sector number;
FM then operates on the entire cluster of which that sector is a
part. You may use the N command, described below, to specify the
number base of your input. If you make a mistake FM comes back
with some help. If you find you want to abort a B, E, G or R
command, just hit the return (enter) key.
Type ctrl-c at the command prompt to abort FM and return to DOS
with the FAT unchanged.
THE ? COMMAND
Lists a command summary, the current number base, and shows the
legal range of values for cluster and sector numbers.
THE B COMMAND
Marks the specified cluster bad, preventing DOS from writing to
it. You enter the cluster or sector number in the current number
base, controlled by the N command. This command only works on
clusters that are not currently occupied by a file.
THE C COMMAND
Lists a summary of all net changes made to the FAT since FM was
started. Changes include marking sectors bad, good, or reserved.
Only net changes are reported. You have the option of
redirecting output to PRN or a disk file. Please read the
caution in section 3. against sending a disk file to the target
THE D COMMAND
Lists the basic sizing parameters of the target disk, such as
sector size, cluster size, FAT size, and root directory size.
These are gathered by reading the boot sector of the target disk.
THE E COMMAND
Examines a cluster to determine its status. Status is either
unused, bad, reserved, or in use by a file. If in use, the file
occupying that cluster is shown. If in use or reserved, the
value of the FAT entry (ie the pointer to the next cluster) is
shown in the selected number base.
THE F COMMAND
Lists all subdirectories and files on the target disk. This is
primarily a programmer's debugging feature, but it has been left
in the public version of FM. You have the option of redirecting
output to another device or file, but please read the caution in
section 3 against writing a file to the target disk.
THE G COMMAND
Marks a bad or reserved sector as unused, available for use. You
enter the cluster or sector number in the current number base,
controlled by the N command. This command only works on clusters
that are currently bad or reserved.
THE L COMMAND
Produces a list of all bad and reserved clusters on the target
disk. FM first asks you which type of cluster you want to list -
bad, unused, reserved or occupied. FM then asks you for an
output device or file, you enter something like PRN for a
printout or a:fm.log for a disk copy. See the caution in section
3. against sending the output to the target disk. THe number
base of the cluster numbers is controlled by the N command.
THE N COMMAND
Controls the number base for numerical input and output. FM
starts assuming decimal, and successive N commands cycle the
number base from decimal to hex to octal, back to decimal.
THE Q COMMAND
Quits FM. Before returning to DOS, FM asks you if you want to
write the FAT out to the target disk. This is the one and only
time FM will write a changed FAT back to the target disk. If you
answer N the target disk is left in its original state.
THE R COMMAND
Marks a cluster as reserved. You enter the cluster or sector
number in the current number base, controlled by the N command.
This command does not work on clusters currently occupied by a
file. NOTE: The concept of reserved cluster appears in several
DOS technical references, but apparently reserved clusters have
no meaning to any available version of DOS (v 3.2 and before).
It is included in FM for the sake of completeness. Marking a
cluster reserved will cause CHKDSK to report an "orphan cluster";
CHKDSK/F will then recover that cluster into one of its .CHK
5. Other Notes
FM was written in C and compiled on the Microsoft C compiler, v
Source code is available upon request.
Comments, suggestions and bug reports are welcome. I can be
reached at the above address, or on the ASTRO BBS, (202) 547-
All rights reserved. This program may be freely copied and
distributed, for personal use only, charging only for media and
duplication costs. This program may not be sold for profit or
distributed in modified form.