Type: External (1.0 and later)
CHKDSK [d:][path][filename] [/F][/V]
Purpose: Checks a disk and provides a file and memory status report.
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). The CHKDSK command was also discussed in Chapter 1, Introduction.
/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).
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.