Category : Tutorials + Patches
Archive   : DOSTIPS6.ZIP
Filename : DOSDISK

Output of file : DOSDISK contained in archive : DOSTIPS6.ZIP
Why It Doesn't Add Up
(PC Magazine Vol 6 No 6 March 31, 1987 PC Tutor)

A curious thing occurs with hard disks, their capacity and the
amount of space used by files. For example, you might run CHKDSK on
a 20-meg hard disk and it shows about 21 megabytes of disk space. You
might have something like 12 megabytes in 770 files and 9 megabytes
free. But when you add up the sizes of all the files manually, you
could account for only something like 8 megabytes leaving some 4
megabytes unaccounted for. Using a hard disk is like going shopping
with only dollar bills and never getting any change back.
The entire data area of a hard disk is divided into smaller areas
called clusters. Files on a disk are always stored in one or more
clusters. If the file does not fill up the last cluster it occupies,
then the rest of the space in that cluster is lost. The number of
byte in each file reported by the DIR command is the size of the file
when it was created or last modified. The amount of space that file
actually requires on the disk is the size of the file after rounding
up to the next multiple of the cluster size.
You can easily determine the cluster size of a particular disk.
First, do a DIR and note the "bytes free" value. Then create a very
small file. The easiest method is by issuing the command:


Now do another DIR and see how much space you've lost. That's your
cluster size.
Cluster size is always a power of 2, and for most normal disks it
is a multiple of 512. Some RAMdisks may have cluster sizes of 128 or
256, but real disks have cluster sizes of 512, 1024, 2048, 4096, and
8192 bytes. For a single-sided floppy diskette, the cluster size is
512 bytes. For a double-sided diskette, it's 1024 bytes. For a 10-
megabyte hard disk, the cluster size is 4096 bytes.
For hard disks larger than 10 megabytes, the cluster size is
dependent upon the DOS version used when the disk was originally
configured with FDISK and FORMAT. A 20-megabyte hard disk originally
configured under DOS 2.x has a cluster size of 8192 bytes.
On average, you will probably lose about half a cluster for each
file on the disk. For the 770 files in the above example, this alone
accounts for about 3 megabytes. If you have a lot of small files whose
length is less than half a cluster in size, this will account for more
loss. In this connection, note that subdirectories (the actual names
of the subdirectories, not the files in them) are stored in the data
area and are subject to the same rules that govern the space required
for data files. CHKDSK reports those figures also.
The real culprit here is the 8192-byte cluster size. It sounds
too big for most uses, and it is. It is the direct result of the
method of storing files on a disk that was introduced way back in
DOS 1.0. This method limited the total number of clusters on a disk
to 4078 (which is 4096 minus some cluster numbers used for special
Under DOS 3.0 and later, however, the total number of possible
clusters on a hard disk was increased to 65,518. This allows using a
much smaller cluster size for a hard disk. A 20- or 30-megabyte hard
disk that has been FDISKed and formatted under DOS 3.x has a cluster
size of 2048 bytes. That's more reasonable.
(With 65,518 clusters available, it is theoretically possible to
have a cluster size of 512 bytes for a 20- or 30-megabyte disk, but
you really don't want clusters that small. Since files may be stored
in noncontiguous areas of a disk, a very small cluster size would
result in files becoming highly fragmented, which would have the effect
of slowing down file access time.)
It is interesting to note that prior to DOS 3.0 (which was
introduced at the same time as the IBM PC AT), IBM did not sell a hard
disk over 10 megabytes. The original PC AT had IBM's first 20-megabyte
hard disk. Although it is entirely possible to install a 20- or 30-
megabyte drive on a PC or XT running DOS 2.x, nobody working with
strict IBM parts ever actually had a cluster size over 4096 bytes.
The problem of excessively large cluster sizes was thus fixed when
IBM simultaneously introduced a 20-megabyte hard disk and DOS 3. In
a sense, then, it's not even IBM's problem if you have a 8192-byte
cluster size.
If you have a hard disk over 10 megabytes originally configured
under DOS 2.x, you can usually reconfigure it under DOS 3.x to get a
smaller cluster size. Read through this section and think about it
before you begin. It's a big job and it's scary. If you don't feel
comfortable with it and you're not sure if you can adequately handle
any problems, don't do it.
This procedure assumes that your hard disk is connected to a hard
disk controller card that has its own ROM BIOS, that you don't need
anything special in a CONFIG.SYS file to use the hard disk, and that
you (or somebody at your computer store) originally configured the
hard disk by running the normal FDISK and FORMAT commands included in
IBM's PC-DOS 2.x.
You'll need a version of PC-DOS 3.0 or later for this. The most
recent DOS version is 3.2.
First, you must back up your entire hard disk, using BACKUP. Do
it twice to play it safe. For 12 megabytes of files, you'll need six
or seven boxes of ten diskettes for the two backups. Use high-quality
diskettes for this. Format them all before you begin. Don't use any
that have bad sectors. The BACKUP command you want is:

BACKUP C:\*.* A: /S

This backs up everything on drive C:, including all subdirectories.
BACKUP will prompt you to put in new diskettes. Label them in sequence
as you go, as you will have to RESTORE them later in the same order.
When you're done with the backup, boot up PC-DOS 3.2 from drive
A: and enter:


Once in the FDISK program, you must first delete the existing DOS
partition, which is one of the options on the menu. Then you must
create a DOS partition, which is another option on the menu. You
probably want to use teh entire hard disk for DOS, so answer Yes to
that question. Your system will not reboot. Make sure the DOS 3.2
diskette is still in drive A:.
When you get back to the DOS prompt, you format the hard disk:


(The /V is optional but allows you to give your hard disk a volume
label, otherwise known as a name.) After this is done, you can verify
that everything is running smoothly by doing a DIR and a CHKDSK on
drive C:. Try rebooting with the drive A: door open. Your machine
should boot from the hard disk. A VER command should report DOS 3.2
(the DOS version you are using). At this point, you can create a small
file to see if your cluster size is indeed smaller. It should be 2048
Delete your small test file and boot up again from the DOS 3.2
floppy. Now you can proceed to RESTORE the backed-up files onto your
hard disk. You should use the DOS 3.2 RESTORE command with the syntax:

RESTORE A: C:\*.* /S /P

This whole process can be very scary, and you may encounter some
"gotchas" along the way. First, some copy-protected programs installed
on a hard disk may not work after a BACKUP and RESTORE. Others will.
Some of the problem programs (1-2-3 Release 2, for instance) can be
deinstalled. If you have any of these programs, deinstall them from
the hard disk before you do your original backups and reinstall them
when you're all done. When in doubt, contact the manufacturer. (After
they give you the information you need, tell them what you think about
copy protection. Use whatever command syntax you feel appropriate.)
Second, people sometimes have problems with BACKUP and RESTORE.
Sometimes RESTORE chokes in the middle of restoring from a bunck of
diskettes. That's why you should do two BACKUPs. You may want to
take other precautions. Your hard disk probably has a number of
purchased programs on it and a number of your own data files in various
subdirectories. You can probably re-create those purchased programs

from the original diskettes. For your own data files, particularly
the ones most valuable to you, use the regular COPY command to copy
them to diskettes.
Third, BACKUP will back up hidden and read-only files, including
the DOS files called IBMBIO.COM and IBMDOS.COM. When you run RESTORE,
you want to use the /P switch as shown above, which prompts you when
it is about to back-up over existing read-only files. When you get
the prompt for IBMBIO.COM and IBMDOS.COM, answer No.
Fourth, RESTORE will still copy the old version of COMMAND.COM
from the backed-up floppies to your hard disk. Thus, when you are
done with the RESTORE operation, recopy COMMAND.COM from the DOS 3.2
floppy diskette to the root directory of the hard disk, using:


(If you boot from the newly formatted hard disk before running RESTORE,
DOS will try to load the COMMAND.COM from the hard disk after RESTORE
is completed. But this would be the old COMMAND.COM. This is why you
should boot from the DOS 3.2 floppy before beginning RESTORE. When
RESTORE ends, you will be prompted to put the DOS disk in drive A:, so
it can find the correct version of COMMAND.COM.)
Fifth, after you're done with the RESTORE, your hard disk will
have regained copies of all the old-version DOS external programs,
such as CHKDSK and MODE. You must replace these with the new DOS 3
versions. DOS 3.2 has a command called REPLACE that automates this
Sixth, sometimes even after all this, funny things happen. For
instance, you may have trouble booting from drive C:. If this is the
case, boot from the DOS 3.2 floppy and get into FDISK again. Choose
the "Change the Active Partition" option in the menu. If the status
of the DOS partition is marked "N", it means it's nonactive, which
explains why you can't boot from it. Make it active. Indeed,
sometimes just entering and leaving FDISK fixes the problem by itself.
If you think that your hard disk still has the old DOS IBMBIO,
IBMDOS, or COMMAND files on it, you can boot from the DOS 3.2 floppy
and execute:




This will reinstall DOS 3.2 on the hard disk.
Seventh, if you have a tape backup unit and you would rather use
that instead of BACKUP and RESTORE, you should determine whether it
does a file-by-file backup or an "image" backup. Many tape backup
units give you a choice. You want to do a file-by-file backup. If
your tape backup unit can only do an image backup, don't use it. The
image stored on the tape will include the hard disk's file allocation
table, and this will be a different format under DOS 3.x. When you
restore the hard disk from the imaged tape, the old file allocation
table will be copied back to the disk. No good. If you do a file-by-
file backup and restore, it will probably copy over the DOS files.
Boto DOS 3.2 from drive A: and do the SYS command and COPY of
COMMAND.COM before you try booting from the hard disk.
Eighth, after you've used DOS 3.x FDISK on a 20-megabyte or
bigger disk, you cannot use the hard disk with any DOS version prior
to 3.0. If you subsequently try to boot up from a DOS 2.x floppy,
DOS simply will not recognize the hard disk. Some people (program
developers, mainly) need to test programs under several DOS versions.
These people may need to have their hard disks recognizable by DOS 2.x.
They shouldn't reconfigure their hard disks, but should put up with the
wastefully large 8192-byte cluster size instead.
Finally, this whole discussion is based on the IBM version of
MS-DOS (which is called "Personal Computer DOS" by IBM and commonly
called "PC-DOS" by the rest of us). Some versions of MS-DOS for other
manufacturers' machines may not support the smaller cluster size, so
doing this will not have any effect. Again, when in doubt, contact
the manufacturer.
As an alternative to using the BACKUP/RESTORE procedure, you might
wish to use the BAC.COM utility from PC Mag Vol 4 No 17. It allows you
to back up all the files in one (sub)directory at a time on the proper
file-by-file (rather than image) basis, and it allows you to change
diskettes as they become full. This last reason is why you can't
easily use the regular COPY command when backing up a whole hard disk.
The files backed up onto floppies with BAC.COM (unlike those made using
BACKUP) are immediately editable, so after backing up your hard disk
files (two BAC copies are recommended for absolute safety) and before
you FDISK and reformat your hard disk, you can delete the obsolete
COMMAND.COM (and other old-version DOS external programs) from the
backup floppies, saving some of the hassle when it comes time to put
them back onto the newly formatted hard disk.

  3 Responses to “Category : Tutorials + Patches
Archive   : DOSTIPS6.ZIP
Filename : DOSDISK

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: