2.7
Disk Management Commands:
FORMAT
Type: External
Syntax: FORMAT
d:[/1][/4][/8][/F:(size)]
[/N:(sectors)]
[/T:(tracks)] [/B|/S][/C]
[/V:(label)]
[/Q][/U][/V]
Purpose: Formats a disk to
accept DOS files.
Discussion
Formats the
disk in the specified drive to accept DOS files, analyzing the entire disk for
defects. Initializes the directory and file allocation tables. Can be used to
format both diskettes and fixed disks.
NOTE:
In some
earlier versions of DOS, the drive designation letter was optional. If you are
using one of these versions, you can format a diskette or a FIXED DISK if you
enter FORMAT while working in that drive.
/1 - Format for
single-sided use, regardless of the drive type.
/4 -
Formats a double-density diskette in a high-density type disk drive. Files
written to a double-sided disk using a high-density drive may not be reliable.
/8 -
Formats at 8 sectors per track. If /8 is not specified, FORMAT defaults to 9 or
15 sectors per track, depending upon the disk drive type. The /V option cannot
be used with the /8 option.
/F:(size)
- Formats disks to specific sizes. You can specify the target disk to be a size
value from 160Kb to 2.88Mb. Do not format a floppy disk at a size higher than
it was designed for.
/N:(sectors)
- Specifies the number of sectors per track on the disk. Used to format a 3.5
inch disk with the number of sectors per track specified using this option. For
720 K-byte disks, this value should be entered as ³N:9.²
/T:(tracks)
- Specifies the number of tracks on the disk. Used to format a 3.5 inch disk
with the number of tracks specified using this option. For both 720 K-byte
disks and 1.44 K-byte disks, this value should be entered as T:80.
/B - Formats a disk
reserving room on the disk to later copy the DOS system files.
/S -
Copies the operating system files to the disk after formatting. These system
files are hidden files and will not appear in a directory listing. Using some
versions of DOS, this must be the last option entered.
/C -
Causes FORMAT to retest bad clusters, otherwise FORMAT will mark the clusters
as bad but will not retest them. (In DOS versions before Version 6, FORMAT
always retested any bad clusters.)
/V:(label)
- Causes FORMAT to prompt for a volume label after the disk is formatted. The
label can be of 1 to 11 characters. The same characters acceptable in filenames
are acceptable in the volume label (however, you cannot add a filename
extension). The /8 option cannot be used with the /V option. DOS Version 5
automatically assigns Label as the disk label and creates a unique serial
number in the boot sector of the disk. The serial number is displayed at the
end of the formatting process.
/Q -
Provides a quick way to format a disk. This option erases the file allocation
table and the root directory, but does not identify bad sectors.
/U -
Completely erases all data on the target disk making it impossible to perform
an UNFORMAT later.
/V - Displays a prompt so
that a volume label can be entered.
Example
If you want to
format a floppy disk as a double-density disk in a 1.2M drive, you should enter
the following: format a:/4
CHKDSK
Type: External
Syntax:
CHKDSK
[d:][path][filename]
[/F][/V]
Purpose: Checks a disk and
provides a file and memory status report.
Discussion
Checks for
errors on a disk. Displays error messages (if problems are found) and issues a
status report.
If you specify
the /F option, the program will correct non-contiguous errors when it finds
them. These errors can be accidentally created due to the fact that DOS does
not always store files in one continuous block on the disk. If space is limited
on the disk (especially if you have previously erased and replaced files), DOS
may store the file in two or more pieces in whatever spaces are available on
the disk. If the links between the clusters (blocks of data) are lost, CHKDSK
will discover the error and report it. By using the /F option, you tell CHKDSK
to find any of these parts of files or programs that have become separated from
the rest of the file, to create a new file for each, and to write the lost
segment to these files. These new files will all start with the letters FILE
and will end with four numbers (starting with 0000) plus a
.CHK extension. The
first file created will be labeled FILE0000.CHK.
When you use
the /F option, CHKDSK also looks for and corrects other types of disk errors
(refer to Appendix A for more information about CHKDSK errors). They include:
Allocation
The size of
the space reserved for a file block is incorrect. This can result in the DOS
error message
Allocation error in file
If you run
CHKDSK using the /F option, it will alter the size allocation number.
Attribute
There are a
number of possible errors having to do with DOS`s internal record of a file`s
attributes. For example, a size of linking attribute associated with one or
more files does not match the actual file information. This can result in the
error message
Entry has a bad attribute
If you run
CHKDSK using the /F option, the program will try to correct the error.
First Cluster Number Invalid
DOS’s internal
directory of file information on the disk contains a pointer to file storage
information that does not match the actual files stored on the disk. This can
result in the error message
First cluster number is invalid,
entry truncated
If you run
CHKDSK using the /F option, the pointer information is corrected (truncated to
a zero length file).
Options
/F -
Corrects errors when it finds them. If CHKDSK finds lost clusters (parts of
files or programs that have become separated from the rest of the file) it will
write the lost segment to new files and provide the filename FILEnnnn
(nnnn
will be a number starting with 0000).
/V -
Displays progress messages while CHKDSK is in operation.
filename
- If you enter a filename, CHKDSK also reports how many files are stored in
non-contiguous blocks (see explanation of non-contiguous blocks above).
Examples
If you enter
chkdsk a:
CHKDSK will
analyze the disk in drive A and report a status message. It will look something
like this:
362496 bytes total disk space
53248 bytes in 2 hidden files
301056 bytes in 8 user files
8192 bytes available on disk
524288 bytes total memory
198976 bytes free
The first four
lines of this display refer to the disk you specified: they indicate the total
disk space (the storage capacity of the disk), the number of hidden (system)
files stored on the disk, the number of user files stored on the disk, and the
amount of storage space still remaining to be used. If you had created
directories on the disk, they would be reported in a fifth line. The last two
lines do not refer to the disk you specified; they indicate the amount of
memory (RAM) in your system and how much of it remains available for use.
If (for
example) three lost clusters are found, the program will also display
3 lost
clusters found in 3 chains.
Convert lost
chains to files (Y/N)?
After this
error message is displayed, you should run CHKDSK again, this time using the /F
option. Enter the command as
chkdsk a: /f
Three new files would be created
on the root directory of the disk with the following filenames:
FILE0000.CHK
FILE0001.CHK
FILE0002.CHK
Each of these
files will contain a lost cluster. You can use your word processor to look at
these files to determine which file the lost segment came from. If the lost
segment came from a text file you may be able to re-merge it with the main
file. However, upon inspection, you may find that the original text file is
intact. This may indicate that the lost segment resulted from file management
tasks carried out by your word processor (or other type of program). In this
case, you can simply delete the newly created segment file.
If the lost
segment came from a program file, you probably will not be able to re-merge it.
If possible, replace the file by re-copying from the original source. If you
cannot replace the file, check the program file that is stored on disk
carefully by running all of its features. It may still be operational.
|