Index | Examples | Syntax  



CHKDSK--Notes

Format of status reports MS-DOS displays CHKDSK status reports similar to the following example: Volume Serial Number is B1AF-AFBF 72,214,528 bytes total disk space 73,728 bytes in 3 hidden files 30,720 bytes in 12 directories 11,493,376 bytes in 386 user files 61,440 bytes in bad sectors 6,055,264 bytes available on disk 2,048 bytes in each allocation unit 35,261 total allocation units on disk 29,568 available allocation units on disk 655,360 total bytes memory 493,456 bytes free Fixing disk errors The ScanDisk program is the preferred method of fixing disk errors. For more information, see the <SCANDISK> command. If you want to use CHKDSK to fix disk errors, use the /F switch. (CHKDSK corrects disk errors only if you specify the /F switch.) CHKDSK /F displays a prompt similar to the following: 10 lost allocation units found in 3 chains. Convert lost chains to files? If you press Y, MS-DOS saves each lost chain in the root directory as a file with a name in the format FILEnnnn.CHK. When CHKDSK finishes, you can examine these files to see if they contain any data you need. If you press N, MS-DOS fixes the disk but does not save the contents of the lost allocation units. If you do not use the /F switch, CHKDSK alerts you with a message if a file needs to be fixed but does not fix the error(s). Using CHKDSK with open files Never use CHKDSK when files are currently open. CHKDSK is designed for use when the files on the disk are in an unchanging state -- that is, when they are not open. When a file is open, it is probably changing, and MS-DOS will update the file allocation table and the directory structure to reflect changes. Such updates are not always made immediately, and updates to the file allocation table and the directories occur at different times. If you run CHKDSK when files are open on the disk, it interprets differences between the directory structure and the file allocation tables as errors. Running CHKDSK /F when files are open can result in corruption or loss of data. Therefore, never run CHKDSK /F from another program, or when Microsoft Windows or the MS-DOS Task Swapper is running. Using CHKDSK with assigned drives and networks The CHKDSK command does not work on drives formed by the SUBST command. You cannot use CHKDSK to check a disk on a network drive. Physical disk errors The CHKDSK command finds only logical errors in the file system, not physical disk errors. To identify and repair physical disk errors, use the ScanDisk program. For more information, see the <SCANDISK> command. Bad disk sectors Bad sectors reported by CHKDSK were marked as "bad" when your disk was first prepared for operation. ScanDisk and other physical disk-error correction utilities can also mark sectors as "bad." Bad sectors pose no danger. Cross-Linked Files CHKDSK reports a cross-linked file if two files or directories are recorded as using the same disk space. If CHKDSK finds a cross-linked file, it displays a message similar to the following: <File is cross linked on allocation unit <number> Some of the information in these files or directories has been lost. CHKDSK will not fix a cross-linked file, even if you specify the /F switch. To correct a cross-linked file, run ScanDisk. Or, to fix them manually, copy the specified files or directories elsewhere and delete the originals. ERRORLEVEL parameters If CHKDSK does not find any errors, it returns an ERRORLEVEL value of 0. If CHKDSK found one or more errors, it returns an ERRORLEVEL value of 255. Saving a CHKDSK status report to a file You can save a CHKDSK status report by redirecting the output to a file. Do not use the /F switch when you redirect CHKDSK output to a file.
-Top- | Examples | Syntax