Note If you're using version 6.2 or later, the ScanDisk program is a better tool for detecting and correcting disk errors. ScanDisk is described in Chapter 9, "Managing Your Hard Disk," in the section called "Checking a Disk for Errors."
Check Disk analyzes the directory on a disk, comparing the directory entries with the locations and lengths of the files, and reports any errors it finds. The Check Disk report includes the following items:
The total amount of space on the disk
The number of files and directories and how much space they use
How much space on the disk remains available for files
In versions 4 and later, the size of each allocation unit, the number of such units on the disk, and the number available for storage
The size of the computer's memory (up to 640 KB) and how many bytes remain free for use
You can also ask the command to display the name of each file on the disk and to check whether any files are stored inefficiently.
If possible, MS-DOS stores files in adjacent, or contiguous, sectors. As files are deleted and new files are stored, however, they can become fragmented (stored in nonadjacent sectors). A fragmented file isn't a cause for worry; the worst that can happen is that MS-DOS will take slightly longer to read the file. If several files on a floppy disk are fragmented, you can restore them to contiguous sectors by copying all the files to an empty, formatted floppy disk with the Copy command. (Remember, don't use the Diskcopy command because it makes a faithful sector-by-sector copy of the floppy disk, storing the files in exactly the same nonadjacent sectors in which they are stored on the original floppy disk.)
The Check Disk command has four parameters:
/V displays the name of each directory and file on the disk.
/F tells MS-DOS to correct any errors it finds in the directory if you so specify when the error is found.
Examples of Checking a Disk
Check the floppy disk in drive A by typing this:
Press any key if MS-DOS prompts you to insert a floppy disk in drive A.
MS-DOS displays its report. (The report you see might be different; this example is for a 360-KB floppy disk.)
Volume DOSDISK created on 01-05-1995 12:00a
Volume Serial Number is 1BC6-425F
362496 bytes total disk space
350208 bytes in 10 user files
12288 bytes available on disk
1024 bytes in each allocation unit
354 total allocation units on disk
12 available allocation units on disk
655360 total bytes memory
562384 bytes free
Note The Check Disk report for MS-DOS 6.2 and later includes a paragraph at the end of the report advising you to use the Scan Disk command instead of Check Disk. See Chapter 9 for more information on Scan Disk.
To check the floppy disk in drive A, and to check whether all files on it are stored in contiguous sectors, type this:
MS-DOS displays the same report as the preceding but adds the following message:
All specified file(s) are contiguous
If any files were stored in noncontiguous sectors, MS-DOS would display their names and the number of noncontiguous blocks of storage in place of this message.
To check the floppy disk in drive A and at the same time display the name of each file on it, type this:
C:\>chkdsk a: /v
MS-DOS displays the name of each file on the floppy disk and then adds its usual report of disk space and memory available. If the list of files scrolls off the top of the screen, remember that, to view it all, you can freeze the display by pressing the Pause key or Ctrl-Num Lock, or use the More command.
Note If the files on the floppy disk are organized into directories, the /V parameter of the Check Disk command lists the directories, as well as the files they contain. Directories are described in Chapter 8, "A Tree of Files."
You can combine the Check Disk parameters in one command; for example, chkdsk a:*.* /v would check the floppy disk in drive A, check all files on it for fragmentation, and display the names of all files.
If the Check Disk command finds an error in the directory, it displays a message such as xx lost allocation units found in yy chains. Convert lost chains to files (Y/N)? Although this message might look confusing, it simply means that Check Disk has found some storage units on the disk that have been used but, because of a program or system problem, aren't linked with any particular files. If you type the Check Disk command with the /F parameter and then type y when the Convert lost chains... message appears, MS-DOS turns these "lost" units into files with the file name and extension FILEnnnn.CHK (where nnnn is a number such as 0001). Depending on the type of error that caused these units to be lost, MS-DOS may or may not be able to recover the data in them. When the Check Disk command is complete, you can look at the contents of these files with the MS-DOS Editor and decide whether or not they contain information you want to save. If you don't want to save the information, delete the files to make the storage space available for new files.