------------------------ MS-DOS v6.22 Help: CHKDSK ------------------------- <Notes> <Examples> <Index> ---------------------------------------------------------------------------- CHKDSK Checks the status of a disk and displays a status report. Can also fix disk errors. The status report shows errors found in the MS-DOS filing system, which consists of the file allocation table and directories. CHKDSK also displays a summary of disk usage. (CHKDSK does not verify that the information in your files can be accurately read.) If errors exist on the disk, CHKDSK alerts you with a message. Note: The ScanDisk program is the preferred method of fixing drive problems, and should be used instead of the CHKDSK /F command. For more information, see the <SCANDISK> command. Syntax CHKDSK [drive:][[path]filename] [/F] [/V] To display the status of the disk in the current drive, use the following syntax: CHKDSK Parameters drive: Specifies the drive that contains the disk that you want CHKDSK to check. [path]filename Specifies the location and name of a file or set of files that you want CHKDSK to check for fragmentation. You can use wildcards (* and ?) to specify multiple files. Switches /F Fixes errors on the disk. Do not use this option when running CHKDSK from other programs; for more information, see "Using CHKDSK With Open Files" in <CHKDSK--Notes>. In general, when fixing disk errors, use <ScanDisk> instead of CHKDSK. /V Displays the name of each file in every directory as the disk is checked. *** <Syntax> <Examples> ---------------------------------------------------------------------------- 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. *** <Syntax> <Notes> ---------------------------------------------------------------------------- CHKDSK--Examples To find out how much data is stored on drive C and how much space is still free, and to check the disk for errors, type the following command: chkdsk c: CHKDSK pauses and displays messages if it encounters errors. To redirect the output of CHKDSK to a file named STATUS, type the following command: chkdsk a: > status Because the output is redirected, MS-DOS does not repair errors it encounters during the check; but it records all the errors in a report file. Afterward, you can use CHKDSK with the /F switch without redirection to correct any errors noted in the status report. *** ---------------------------------------------------------------------------- <Top of page>
Last update: December 07, 2002 14:45 by Content © 1997 Microsoft Corporation All else © 2000-2005 |