ARCHIVED: In DOS, what does the CHKDSK (check disk) command do?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Usage

The CHKDSK (CHecK DiSK) command reports on a number of items concerning your drive, the amount of space used, and the amount of space still available. The first five to six lines report information about your hard disk.

The syntax for CHKDSK is:

  CHKDSK [drive:][[path]filename] [/F] [/V]

The drive: and path parameters specify the drive and directory to check, and filename specifies the file(s) to check. The following switches are also available:

  • Use /F to fix errors reported on the disk, such as "Lost Allocation Units".
  • Use /V to show the full path and name of each file on that disk.

To check the current disk, use CHKDSK with no parameters:

  CHKDSK

Bad sectors

Do not be alarmed by sectors on your disk that are labeled "bad sector". When hard disks are manufactured, there are sometimes minute flaws in the surface of the disk that would not be good for storing data. When a hard disk is formatted, DOS inspects the disk, marks any questionable areas as bad sectors, and prohibits data from being written to these areas. There is no current problem with the disk, and you don't need to do anything.

Error messages about lost chains

When DOS saves a file, it places an End of File marker at the very end of the file. In addition, the information about the location and length of the file is kept in the File Allocation Table (FAT). This is what you see when you enter DIR at the command prompt.

If, for some reason, a computer fails to save all of a file (if the power goes out, the computer gets turned off, or the computer gets rebooted), DOS cannot mark the end of the file, and the FAT table is incomplete. DOS knows where the file starts, but is unsure of where it ends. The last few unidentified, unattached bits of file are called "lost chains". You should see:

  Convert Lost Chains to Files (Y/N)?

After looking at the CHKDSK report, start the process over again, but enter CHKDSK/F. When you enter just CHKDSK, you cannot have it fix the problems whether you press y or n. The /F is a parameter that tells DOS that you want to fix the problems.

DOS will let you take the information in these lost chains and save it to a file, so you can review it to see if it contains information that you need to salvage. Answer the question above by pressing either y to make these files or n to erase the chains and not make files.

If you press y to save files, they are put in the root directory of the current logged drive. DOS saves the information in files named FILE0000.CHK, FILE0001.CHK, and so on, creating one file for each lost chain. To look at them, enter:

  TYPE FILE0000.CHK | More

The vertical line is a DOS pipe command, allowing you to place two commands on the same line. The More command prints a single screen of information at a time. If the information in these files is garbage (unintelligible characters and beeps), delete the file by entering:

  DEL FILE000.CHK

Allocation units

The allocation units in the above example are reported on computers that have DOS 4.0 or later. It is an indication of the smallest storage unit on the drive. In this case, that is 2048 bytes. In other words, when you create a batch file that has 52 bytes, you will have to use 2048 bytes disk space to save it.

Related tools

Microsoft ScanDisk is a disk analysis and repair tool packaged with MS-DOS 6.2 that checks a drive for errors and corrects any problems it finds.

To check the current drive for disk errors, use:

  SCANDISK

This is document aall in the Knowledge Base.
Last modified on 2018-01-18 08:52:01.