DOS Keys    \|/    by Kari Jackson
~~~~~~~~           Contributing Editor

"Digging into the intricacies of the DOS FORMAT command"
(Part I originally published in June/July 1994 PCM)

                      THE FORMAT COMMAND, PART I

   Since no disk can be used before it has been formatted, most computer 
users have some idea of what formatting is all about. But DOS's FORMAT 
command holds many secrets from even the most experienced user.

   Before a disk has been formatted, it's completely unusable. Just like a 
parking lot would be without lines painted on it if people were as 
helpless as DOS is. DOS can't "park" a file without being able to see the 
"lines" on the "parking lot."

   There are two different types of formatting. Low-level formatting means 
laying down magnetic patterns called tracks (concentric circles) and 
dividing those tracks into pieces called sectors. This is done by writing 
a sector header just before each area that should be regarded as a sector. 
A sector header is a chunk of data that sort of says "I am Sector 6 of 
Track 15 of Side 1 of this disk." Each sector gets its own header and when 
all the disk space is divided into sectors, DOS is able to tell where to 
go to read or write data on the disk. Also, each of the 512 bytes of space 
in each sector is filled with FFh, F6h or OOh so that no spot on the disk 
is truly blank.

   Sector headers do use disk space. If you've seen a box of double 
density 3-1/2-inch disks labelled as 1MB when you think they should be 
720K, that's why. The disks are prepared to hold one million bytes, which 
is close enough to 1MB (1,048,576 bytes) for practical purposes. Low-level 
formatting takes up 262,720 bytes of space, leaving 737,280 bytes (exactly 
720K). So when someone calls it a 1MB disk, they're talking about the size 
before low-level formatting. Each disk size has a similar ratio of low-
level format space to usable space.

   On a hard drive, DOS's FORMAT command doesn't do the low-level 
formatting at all. This is done by the manufacturer of the drive, or by a 
program in a ROM chip on the drive controller, which you can access via 
the DEBUG command or your CMOS setup. Don't ever low-level format an IDE 
drive unless you know exactly what you're doing, because some IDE drives 
can be physically ruined by low-level formatting them with the wrong 
program.

   The FORMAT command does do a low-level format on floppy disks. With MS-
DOS 5.0 and later, you can make FORMAT skip low-level formatting. The 
FORMAT command in earlier DOS versions always did both the low-level 
format and the high-level format when used on floppy disks. (By the way, 
whenever I say DOS 5.0, I really mean DOS 5.0 and later unless I 
specifically say otherwise.)

   High-level formatting simply scans all of the sectors on the disk for 
readability (remember, even if the disk has never been used, the low-level 
format process has written FFh, F6h, or OOh characters all over it), 
followed by creation of the boot record, FAT and root directory.


The Boot Record

   The first sector of any floppy disk or hard drive partition is the boot 
record. The boot record of any disk contains information that DOS needs to 
know before it can read the disk. Like how many bytes per sector (almost 
always 512), how many sectors per cluster (we'll get to that later), how 
many sectors on the disk, how large the FAT and root directory are, etc. 
The boot record also contains a little program that runs every time you 
attempt to boot the computer from that disk.

   Even if a disk has not been made bootable, it still has this program in 
its boot record. When the computer tries to boot and there's a disk in 
Drive A (unless the computer boots from ROM or the CMOS has been set to 
make the computer skip Drive A at bootup), it runs the program that's in 
the boot record. When you boot from your hard drive, the computer runs the 
hard drive's boot-record program. The boot-record program is kind of like 
this: "See if there's a file named IO.SYS and, if so, load it into memory 
and turn control over to it. If not, display the message 'Non-System disk 
or disk error. Replace and press any key when ready' on the screen, wait 
for a key press, then run the next disk's boot record program."

   Of course if the disk was formatted by PC-DOS or DR-DOS rather than MS-
DOS, the boot record looks for IBMBIO.COM rather than IO.SYS. Each 
operating system has its own FORMAT command that knows what filename it 
should put into the boot record.

   If you let the computer attempt to boot from a disk that hasn't been 
made bootable, the boot-record program attempts to find IO.SYS, but IO.SYS 
isn't on the disk so the computer displays an error message and waits for 
you to insert another disk. If you attempt to boot from a bootable disk, 
the boot-record program causes the computer to load IO.SYS, and IO.SYS 
takes care of the rest of the boot process.


The FAT

   The second thing that's created on a disk during a high-level format is 
the File Allocation Table, or FAT. The FAT is so important that there are 
actually two synchronized copies of it on every disk and hard-drive 
partition.

   The File Allocation Table tells DOS which parts of the disk belong to 
each file, and which parts are still available for use by new files. 
There's a FAT entry for each cluster of space on a disk, which is simply a 
group of sectors.

   Back when DOS was being designed, the FAT was kept in memory for fast 
access. Since precious memory is needed for everything else the computer 
is doing, the FAT needed to be small so it didn't use too much memory. If 
the FAT contained one entry for every sector on a disk, it would be huge 
compared to the tiny amount of memory that was included with the first DOS 
computers! So sectors are grouped together into clusters according to this 
table:

            Disk or            Sectors        Bytes Per
            Partition Size     Per Cluster    Cluster

            DD Floppy             2             1024
            HD Floppy             1              512
            0-16MB                8             4096
            16-128MB              4             2048
            128-256MB             8             4096
            256-512MB            16             8192
            512-1024MB           32            16384

   Therefore, the FAT has one entry for each cluster rather than one entry 
for each sector. Since a FAT entry can't belong to more than one file, a 
cluster of disk space can have one (and only one) file in it. Even if a 
file is one byte long, it still uses an entire cluster because there's no 
way to let the rest of the cluster be used by another file. If a file is 
two bytes larger than eight clusters, it uses nine entire clusters. The 
wasted space between the last byte of a file and the last byte of its last 
cluster is known as slack space.

   There's a FAT entry for each cluster of disk space and each entry 
points to the next FAT entry for the file that owns the cluster 
represented by this entry. If a file is only one cluster long, its FAT 
entry contains a code that DOS recognizes as meaning "End of File."

   Let's say a file's directory entry (we'll get to that in a few minutes) 
says the file starts in Cluster 229. The 229th entry in the FAT represents 
the 229th cluster of disk space, so FAT Entry 229 belongs to this file. If 
FAT entry 229 has the code for "End of File," Cluster 229 is the only part 
of the disk that belongs to this file. If FAT Entry 229 says 278, Cluster 
278 also belongs to this file. Now FAT Entry 278, which represents Cluster 
278, might say "End of File" or it might contain another number pointing 
to another cluster of disk space. And on and on, until one of the FAT 
entries owned by this file contains the code for "End of File."

   A FAT entry can be any one of the following:

      []  Zero, meaning the cluster is not in use.
      []  A number that points to the next cluster 
             used by the file.
      []  A code that means "End of File."
      []  A code that means "Bad sector; do not use 
             this cluster."

Note that the file described in the example owns clusters that are not 
contiguous. This means the file is fragmented. Pieces of the file are 
spread across different areas of the disk rather than next to each other. 
This doesn't mean the file is going to get damaged or that it's harder for 
DOS to find it or anything like that. The file is perfectly safe. The only 
thing wrong with it is that it takes the drive longer to get to all the 
parts of the file than it would if all the parts were together. So reading 
the file or writing to it takes a few dozen milliseconds longer than it 
should.

   The main thing that causes fragmentation of files is deletion of other 
files. When a disk is empty, each file gets put into contiguous clusters 
because all the free space is contiguous. When you delete one of the 
earlier files, a hole is left between sections of used space. The next 
file DOS saves to the disk may very well get put into that spot, even if 
the file is too big to fit there. This means the beginning of the file 
gets put into one area and the rest of the file is written somewhere else.

   The other cause of fragmentation is that many files do not remain 
constant in size. A contiguous file may get fragmented if you enlarge it. 
New files have most likely been added to the disk since this file was 
first put there, so there's no longer any blank space at the end of that 
file. If you add more data to the end of a file, DOS might have to put the 
additional data somewhere else.

   A program that rearranges the files on a disk so that all the parts of 
each file are next to each other, or in contiguous clusters, is called a 
disk optimizer or defrag-menter. MS-DOS 6.0 comes with the DEFRAG utility 
and there are lots of third-party utilities such as PC Tools and Norton 
Utilities that include disk optimizers.


The Root Directory

   The third thing that is put onto a disk by the high-level format 
process is the root directory. If you type DIR at the C:\> prompt, what 
you see is a translated version of your hard drive's root directory. You 
probably know what a directory listing looks like, so let's take a look at 
a chunk of it in its natural form, before DIR has translated it (see 
Figure 1). Each directory entry is 32 bytes long. If you have an ASCII 
chart handy, you can see that the first eleven bytes spell the filename in 
Hex. The first eleven bytes of the first entry are "IOSYS" (the "" 
character is used to represent one space). Now you can see why it's not 
possible to have a filename longer than eight characters or an extension 
longer than three.

   Byte 12 of each directory entry is the attributes byte. The right-most 
six bits represent six possible attributes: archive, directory, volume 
label, system, hidden and read-only. To decode an attribute byte, convert 
it to binary. The value O7h (OOOOO111 in binary) shows IO.SYS has the 
system, hidden and read-only attributes. The last three bits of the 
attribute byte stand for system, hidden and read-only. As another example, 
a file that has 1Oh in its attribute byte is a directory because 1Oh is 
OOO1OOOO binary, which has a 1 in its fourth digit and the fourth bit is 
the directory attribute. (The left-most two bits of the attribute byte are 
unused and must always be zero.)

   The next ten bytes of every directory entry are reserved and are always 
filled with zeros by DOS.

   The 23rd and 24th bytes of each directory entry store the time of last 
modification to the file. For example, OO28h means 5:00 a.m. How? Well, 
like a lot of weird things computers do, these numbers are stored 
backwards (least-significant byte (OOh) then most- significant byte 
(28h)). Before you can make any sense out of these numbers, you have to 
turn them around (28OOh) then convert each digit to binary (OO1O 1OOO OOOO 
OOOOh). The first five bits of the result (OO1O1h) are the hour. The next 
six bits (OOOOOOh) are the minute. The last five bits (OOOOOh)  multiplied 
by two is the number of seconds.

   The 25th and 26th bytes of the directory entry are the date of the last 
modification to the file. Again, change the order and convert each digit 
to binary. The first seven bits are the year and that needs to be added to 
1980 since that's the year with which all DOS clocks begin. The next four 
bits are the month and the last five are the date.

   The next two bytes of a directory entry point to the first FAT entry 
that belongs to the file. Again, it's stored in reverse order so O2OOh 
actually means FAT Entry 2, which happens to be the first FAT entry that's 
available for use by files. (Entries zero and one are reserved.) This 
means IO.SYS begins in the second cluster of the data area of the disk. Of 
course, FAT Entry 2 tells us the next cluster used by the file.

   The last four bytes of a directory entry tell us the size of the file. 
For example, IO.SYS is 9682OOOOh (again, reverse the order of the bytes to 
OOOO8296h) and that's 33,430 bytes in decimal.

   The root directory is a chunk of disk space that's set aside to be used 
solely for the purpose of storing directory entries. The size of the root 
directory depends on the size of the disk and it can never be enlarged 
once the FORMAT command has created it. The root directory on a double-
density floppy is big enough to hold 112 entries. On a high-density 
floppy, it's large enough to hold 224 entries. On a hard drive, the root 
directory is large enough to hold 512 entries.

   Directory entries are used by files, subdirectories and the disk's 
volume label if it has one. If you have a double-density floppy disk that 
has a volume label and seven subdirectories, you can write only 104 files 
into the root directory of that disk -- even if there's 100K of space 
left, it still can't hold more files unless you put them into the 
subdirectories.

   The FORMAT command performs a low-level format on floppy disks, and it 
creates a boot sector, FAT and root directory on both hard drives and 
floppy disks. Except for any FAT entries that need to be marked unusable 
due to bad spots found during the readability scan, the FAT and root 
directory are completely filled with zeros. Then FORMAT gives a summary of 
how much space is on the disk and asks whether you want to format another 
disk. However, there are ways to make FORMAT do other things or to make it 
skip certain steps that it normally performs.


Making a Bootable Disk

   The most common "extra" thing people want the FORMAT command to do is 
make a disk bootable, which is done with the /S switch. This means FORMAT 
copies the IO.SYS and MSDOS.SYS files from the disk you booted from to the 
disk that's just been formatted. Note that MS-DOS 6.0 and 6.20 also copy 
DBLSPACE.BIN to the disk. (You won't see those files in an ordinary 
directory listing since they have their hidden and system attributes 
turned on to avoid deletion.) Then FORMAT looks at the COMSPEC environment 
variable to find COMMAND.COM and copies it to the disk. Now the disk can 
be used to boot the computer.

   Before DOS 4.0, DOS couldn't boot unless IO.SYS and MSDOS.SYS were in 
contiguous clusters; that is, not fragmented. These two files also had to 
be stored in the first and consecutive clusters on the disk (just after 
the boot record, FAT and root directory). In other words, you can't make a 
disk bootable with DOS 3.30 and earlier if the disk already has files on 
it. (Norton Utilities, PC Tools and some other packages can move files to 
make room for IO.SYS and MSDOS.SYS.) An exception to this is if the disk 
has been formatted with the /B switch.

   The /B switch doesn't put IO.SYS and MSDOS.SYS onto a disk like the /S 
switch does, but it pretends to. It makes entries in the FAT and root 
directory as if it were putting the files there. In the place where IO.SYS 
would go, it puts a little program that tells the computer to display 
"Non-System disk or disk error" on the screen, then fills the rest of the 
space with random garbage -- whatever happens to be in memory at the time.

   With recent DOS versions, there's very rarely any need for the /B 
switch since the DOS system files don't need to be in any particular part 
of the disk (though they do need to be in the first two directory entries 
in the root directory) and they don't need to be contiguous 
(unfragmented). The SYS command rearranges the root directory if necessary 
to put IO.SYS and MSDOS.SYS in the first two directory entries. This means 
SYS is all you need to make a disk bootable -- even if the disk already 
has other files on it. If you want to put files on a disk and then be able 
to later make it bootable with an earlier DOS version, the /B switch is 
still necessary.

                                  -=*=-

                      THE FORMAT COMMAND, PART II

   If FORMAT isn't told otherwise, it formats disks to the highest 
capacity it thinks your drive supports. Things that can affect what it 
thinks your drive supports are your BIOS and CMOS settings, the DRIVER.SYS 
device driver, DRIVPARM and the capacities your version of FORMAT 
supports. If your CMOS setup says Drive B is 720K, FORMAT will format 
disks in Drive B to a capacity of 720K no matter what capacity Drive B 
really is.

   Note that FORMAT didn't support 720K disks until DOS 3.2, 1.44MB disks 
until DOS 3.3, and 2.88MB until DOS 5.0. If your version of DOS is older 
than your type of floppy drive, FORMAT won't know what to do.

   If you upgrade DOS and find the new version of FORMAT thinks your 720K 
drive is 360K, even though the drive is still working fine in other 
respects, don't worry. That's easily fixed. Some Tandy computers have 720K 
drives without BIOS support for them, so they were sold with an altered 
version of DOS to provide that support. All you need to do is use the 
DRIVPARM command in the CONFIG.SYS file of every disk (including your hard 
drive) from which you boot. Use the line DRIVPARM=/I /D:O /F:2 for Drive 
A; use /D:1 instead of /D:O for Drive B.

   If you're trying to format a disk and get "Track 0 bad," you're 
probably trying to format a 720K disk to 1.44MB. Use the /F switch to tell 
FORMAT to format the disk to 720K instead and it should be fine.

   FORMAT won't format a disk to a higher capacity than it thinks the 
drive supports, but it will go lower if you tell it to. If you have DOS 
4.0 or later, use the /F switch. Using /F:72O with the FORMAT command 
makes it format disks to a capacity of 720K. Use the /F:36O switch for 
360K disks.

   If you have DOS 3.30 or earlier, there is no /F switch. To format a 
360K in a 1.2MB drive, use the /4 switch. To format a 720K disk in a 
1.44MB drive, use /N:9 /T:8O, which means nine sectors per track and 80 
tracks per side, which is the layout of a 720K disk.

   You should never format a disk to a capacity other than that for which 
it was created. In order to get the data packed more tightly, high-
capacity drives use a weaker signal so data won't be affected by overlap 
from the data next to it. Likewise, it uses a stronger signal when writing 
to double-density disks. Each type of disk has a coating that works with 
the signal strength it is supposed to be used with. The coating doesn't 
reliably hold data when written to by the other strength signal.

   Also, 5-1/4-inch drives have a problem that 3-1/2-inch drives don't. 
Instead of just doubling the number of sectors per track, as in 720K 
versus 1.44MB disks, another difference between 360K and 1.2MB disks is 
that the number of tracks is doubled. In order to fit twice as many tracks 
into the same space, 1.2MB drives write tracks that are half as wide as 
tracks written by a 360K drive. Even when a 1.2MB drive is writing to a 
360K disk, it still writes the same narrow track. This causes huge 
problems when you try to use the same disk in both types of drives.

   If you format a disk in a 360K drive, each sector is filled with F6h 
characters. If you then write to that disk with a 1.2MB drive, its tracks 
will have a narrow band of data (F6h characters) on each side left over 
from the 360K drive's heads. The 1.2MB drive will be able to read it just 
fine because it only reads the same narrow track as it writes. But the 
360K drive reads the whole track and gets really confused as to what it's 
seeing.

   If you need to share a disk between a 360K drive and a 1.2MB drive, use 
a disk that's been formatted by the 1.2MB drive without ever having been 
formatted by a 360K drive. If it's possible to avoid writing to the disk 
with the 360K drive, do that too. If you have to write to it with the 360K 
drive, that's OK as long as you don't ever write over the top of the same 
area with the 1.2MB drive. The 360K drive should be able to read it 
because there will be no wide tracks overlapping the narrow tracks written 
by the 1.2MB drive.


Bad Sectors

   Part of the high-level format process is the scan for readability. 
Unless DOS 5.0's /Q switch is used, FORMAT reads every sector to make sure 
they are readable. If there are any sectors it can't read, even after 
retrying a couple of times, it marks those sectors as bad at the end of 
the high-level format. In this way DOS knows not to put any data there. 
That's what you're seeing when CHKDSK tells you "xxxxx bytes in bad 
sectors." What would be dangerous is bad sectors that are not marked. DOS 
would eventually put data there and not be able to read it later. Other 
ways to get bad sectors marked in the FAT, besides using FORMAT, is to use 
RECOVER (a very dangerous command when not used exactly the way it's 
supposed to be), DOS 6.2's SCANDISK and third-party utilities like PC 
Tools and Norton Utilities.

   Any time you format a disk (unless you use DOS 5.0's /Q switch), DOS 
ignores the FAT and just rescans the whole disk. A disk that has bad 
sectors might end up without bad sectors if you format it again. This may 
be because the low-level format needs to be rewritten (all magnetic media 
fades over the years), or it may be because there was a piece of dust on 
the disk the first time it was formatted. The sector may not have really 
been bad, but was unreadable with the dust sitting there, so FORMAT just 
thought it was a bad sector.

   On the other hand, some third-party utilities are more thorough in 
their search for bad sectors than the FORMAT command is. If some other 
utility marks a sector as bad, then you use DOS' FORMAT command on that 
disk later, the "bad" sector might get marked as good again. You might not 
want that if you trust your other utility more than you trust FORMAT. 
Apparently a lot of people complained about it because DOS 6.2 doesn't do 
it anymore. If you use the /C switch with FORMAT, it will. By default, 
what happens with DOS 6.2 is this: Before formatting begins, FORMAT reads 
the disk's FAT and remembers which sectors were marked as bad. When the 
new FAT is being written, it marks those same sectors as bad again, even 
if they passed the test this time.

   Besides using the /C switch, another way to get DOS 6.2's FORMAT to act 
like earlier DOS versions is to use the /F switch. But the /F switch 
should have nothing to do with that, you say? That's right, but it does 
anyway. If you format a disk to a smaller capacity than the drive can 
hold, you have to use the /F switch. When you do, FORMAT acts as if you 
had also used the /C switch. No, you can't get around this by using the /N 
and /T switches either, because they also cause this misbehavior. The only 
way to get DOS 6.2's FORMAT command to save old bad sector markings when 
formatting a disk to a smaller capacity is to use the /Q switch to make 
FORMAT skip the bad sector scan.


Volume Labels

   If you have DOS 3.3 or earlier and you want to assign a volume label to 
the disk, you can tell FORMAT so with the /V switch. After formatting, it 
asks you to enter the volume label. If you have DOS 4.0 or later, FORMAT 
always asks that question so the only reason to use the /V switch is to 
supply the volume label in advance. If you use /V:THISNAME with FORMAT, it 
adds the label THISNAME to the disk.

   If your DOS version is between 3.2 and 4.01, it's a very good idea to 
make sure your hard drive has a volume label because FORMAT in these 
versions has a nice safeguard built in. When you attempt to format a hard 
drive that has a volume label, it makes you enter the current volume label 
before it formats the drive. So it's really impossible to accidentally 
format a hard drive as long as it has a label. (You can add a volume label 
without formatting it by using the LABEL command.) This safeguard was 
removed from DOS 5.0's FORMAT command, probably because DOS 5.0's FORMAT 
is non-destructive so it doesn't need safeguards as badly as earlier 
versions.


The Safe Format

   Before DOS 5.0, formatting a floppy disk meant the data on it would be 
almost completely unrecoverable because it would be overwritten with F6h 
characters as part of the low-level format process. (You could pay a 
fortune to a data-recovery company to attempt to get it back.) Formatting 
a hard drive would not overwrite the data with anything but would 
completely erase the FAT and root directory, so the data would still be 
very, very hard to recover even though it's still intact on the disk. DOS 
5.0's FORMAT command is different, thanks to some technology licensed by 
Microsoft from Central Point Software, the makers of PC Tools.

   The first thing DOS 5.0's FORMAT command does is run MIRROR. MIRROR is 
a program from PC Tools that is included in the FORMAT.COM file in DOS 5.0 
and later, and also as a separate program in DOS 5.0. What MIRROR does is 
this: It creates a file named MIRROR.FIL on the disk, which contains 
snapshots of the disk's boot record, FAT and root directory. Then it 
creates a file named MIRORSAV.FIL in the last cluster of the disk, even if 
it has to move other files out of the way in order to put it there. The 
MIRORSAV.FIL file's first two bytes hold the number of the sector where 
MIRROR.FIL can be found. The next thing DOS 5.0's FORMAT does is a high-
level format. It doesn't do a low-level format by default, even on floppy 
disks, so it doesn't overwrite any data on the disk.

   If you realize a few minutes later that you didn't mean to format the 
disk, you can run DOS 5.0's UNFORMAT command on it to perfectly restore 
every speck of data on the disk. UNFORMAT looks at the last cluster of the 
disk, expecting to find the string LIFVASRORIM (MIRORSAVFIL backwards).

   The MIRROR.FIL file's first few characters are A:\MIRROR.FIL or 
C:\MIRROR.FIL so UNFORMAT can be sure it's looking at the right part of 
the disk. UNFORMAT takes the data in the MIRROR.FIL file and puts it back 
into the boot record, FAT and root directory. Voil! Your disk is back to 
the exact state it was in before you formatted it, and that's why DOS 
5.0's FORMAT is called a "safe" format.

   If FORMAT ever tells you

      Drive A error. Insufficient space for the 
         MIRROR image file.

      There was an error creating the format recovery
         file.

      This disk cannot be unformatted.

      Proceed with Format (Y/N)?

the DOS manual says you're supposed to delete some files from the disk and 
try again. As far as I'm concerned, that's pure nonsense. If you're going 
to look on the disk to see what files it has on it and decide which ones 
to delete, why don't you just make sure you don't want any of the files? 
Then you won't have any reason to need FORMAT to do a "safe" format on 
that disk! Actually, though, you should have already done that before you 
ever entered the FORMAT command in the first place. Just because FORMAT is 
safer than it used to be is no reason for carelessness. Anyway, if you do 
already know you don't want to keep any of the files on the disk, press Y 
to the question and FORMAT pretends you used the /U switch.


Skipping the Safe Format

   The /U switch makes FORMAT skip the MIRROR process and do a low-level 
format. The /U stands for unconditional, but to me it would make more 
sense if it stood for unsafe. FORMAT /U in DOS 5.0 does the same thing as 
FORMAT with no switches in previous DOS versions. Also, whenever you try 
to format a disk to a capacity other than that at which it had originally 
been formatted, FORMAT always acts like you used the /U switch even if you 
didn't. If you format a 720K disk and then later try to format it to 
1.44MB, for example, you're going to get an "unsafe" unconditional format 
whether you want it or not.

   Have you ever noticed how long it takes for DOS to come back with the 
"Abort, Retry, Fail, Ignore?" error message when you accidentally try to 
read a disk that's never been formatted? That's also how much time you 
waste if you neglect to use the /U switch when formatting a disk that's 
never been formatted. Without the /U switch, DOS 5.0's FORMAT tries to 
read the disk to make a snapshot of the FAT and stuff. Not only is there 
no reason to do that on a blank disk, it also wastes up to 45 seconds 
because the drive can take that long before it gives up and tells FORMAT 
it can't read the disk. So on unformatted disks, always remember to use 
the /U switch if you have DOS 5.0 or later. If you have DOS 6.2, be sure 
to use the /C switch also for the same reason. Without the /C switch, 
FORMAT tries to read the disk's FAT to see if any sectors are marked as 
bad.


Quick Formatting

   If you want DOS 5.0's FORMAT to hurry up and get done, at the expense 
of the scan for bad sectors, use the /Q switch. That stands for quick. If 
a disk hasn't been formatted in the past year or so, you shouldn't do 
that. A low-level format that old should be refreshed, so you should 
really use the  /U switch. Even if you refuse to do that, at least skip 
the use of /Q so FORMAT will make sure there are no unmarked bad sectors. 
Use /Q only on disks that have been formatted without /Q recently. If you 
want FORMAT to skip the bad sector scan, the low-level format and the 
MIRROR process, use /Q and /U together. Don't use /C with  /Q since it 
will have no effect; you can't scan for bad sectors while you're skipping 
the bad sector scan.


Avoiding the Prompts

   The FORMAT command has two undocumented switches that make it skip some 
or all of its questions. The /AUTOTEST switch makes it skip all of the 
prompts -- even the one that asks for confirmation when you're about to 
format a hard disk! Be careful with it!

   The /BACKUP switch is what DOS 3.3's BACKUP command uses when it calls 
the FORMAT command to format floppy disks during the backup process. It 
causes FORMAT to skip all the prompts except the one about the volume 
label. Since the BACKUP command also uses the /V switch when it calls the 
FORMAT command, it doesn't need to skip this prompt. Since /AUTOTEST makes 
FORMAT ignore the /V switch, you need to use /BACKUP instead if you want 
to give the disk a volume label.

   Besides danger, another problem with  /AUTOTEST and /BACKUP is that you 
can't use DOS 5.0's /Q switch with them.


When to Format

   So when do you format a disk? Lots of times:

   []  Before you use it for the first time, unless you bought 
preformatted disks.
   []  Whenever you want an easy way to remove all files, subdirectories 
and the volume label from a disk all in one step.
   []  Before you use it as the target of a DISKCOPY command. Yes, it's 
true that DISKCOPY copies an image of the disk from the source to the 
target, which means the target disk doesn't have to be formatted. Taking 
this at face value is foolish -- especially if the target disk has a bad 
sector.
   []  Whenever it's been a long time since the disk was last low-level 
formatted. The closer the disk is stored to any sort of magnetic field 
(telephone, electric cords, stereo speakers, wires or anything with an 
electric motor and especially your monitor), the more likely that its 
magnetic charge is fading. If the sector headers haven't been written in 
so long that they're fading, it doesn't matter if the data was put onto 
the disk two weeks ago; it still might be unreadable. The data may be 
fine, but you can't get to it unless the sector headers are fresh enough 
to be readable. There are third-party utilities that can read data from a 
disk, low-level format it, and write the data to the disk again. Such 
utilities (like PC Tools PCFORMAT with the /R switch for floppy disks and 
Gibson Research's SpinRite for certain types of hard drives) easily take 
care of the problem of fading sector headers.


                                  -=*=-

               Kari Jackson, author of the online manual *DOS,
            Simply Said, Simply Done, Simply Easy!*, spends 
            most of the day managing Delphi's OS/2 forum, 
            writing REXX programs, consulting, and discus-
            sing computing on several online services. You 
            can find her at karijackson@delphi.com on Inter-
            net, but please understand that she can't answer
            every question she receives.

-=--------------        -=*=-     -=*=-     -=*=-        --------------=-
