Source: Western ewang HKDSK
Status reports show MS-C Article Source: logical errors in the DOS file system, which consists of a file allocation table (FAT) and a directory (CHKDSK does not verify that the information in the file can be accurately read ). If the disk has an error, CHKDSK will give a warning message. Therefore, CHKDSK should be used from time to check for disk errors to ensure the normal operation of the system.
1. syntax of the CHKDSK command
CHKDSK drive: [[path] filename] [/F] [/V]
To display the disk status of the current drive, run the following command:
CHKDSK
Ii. Parameter Interpretation of The CHKDSK command
(1) drive
Specifies the drive of the disk to be checked by CHKDSK.
(2) [path] filename
Specifies the path and name of one or more files whose CHKDSK is used for fragment check. wildcards (* Or?) are available ?) Specify multiple files.
Iii. Switch of the CHKDSK command
(1)/F
Corrected disk errors. Note that do not select this option when running CHKDSK from other applications (such as Windows.
(2)/V
During disk check, files under each directory are displayed.
4. Help Information Acquisition
It doesn't matter if you don't know how to use the CHKDSK command /? You can understand its usage.
V. Comments on the CHKDSK command
(1) form of status report
The MS-DOS displays the CHKDSK status report in a similar way:
Volume MS-DOS_6 created 07-16-1996 10: 40a
Volume Serial Number is 2111-59F0
629,424,128 bytes total disk space
638,976 bytes in 15 hidden files
1,146,880 bytes in 70 directories
120,766,464 bytes in 1,802 user files
506,871,808 bytes available on disk
(2) Correcting disk errors
When correcting disk errors, it is best to use the ScanDisk program. For more information, see the (SCANDISK) command. The following figure shows how to use the CHKDSK/F command to correct disk errors:
10 lost allocation units found 3 chains convert lost chains to files?
If you press Y, the MS-DOS puts each lost chain in the root directory with FILEnnnn
In the. CHK format, the file name stores the file. nnnn is a number starting from 0000. After the CHKDSK check is completed, you can check whether these files contain the required data. If so, you can edit and use them. Otherwise, you can delete all of them, to avoid disk space occupation. If N is selected, the MS-DOS fixes only the disk, but does not save the contents of the lost allocation unit.
If you do not need the/F switch, CHKDSK will present a message to remind you whether the file needs to be corrected and restored, but will not conduct actual error correction.
(3) ERRORLEVER Parameters
If no error is found in the CHKDSK, the returned ERRORLEVER value is 0. If one or more errors are found, the returned ERRORLEVER value is 255.
Vi. Precautions for using the CHKDSK command
(1) When an opened file exists in the system
Do not use CHKDSK when a file is opened. Because CHKDSK is designed to assume that the disk file is closed. When a file opens, the corresponding MS-DOS modifies the File Allocation Table and directory structure. This change does not necessarily happen immediately. Changes to the file allocation table and directory structure occur at different times. Therefore, if CHKDSK is run when files on the disk are opened, the inconsistency between the directory structure and the file allocation table is interpreted as an error, resulting in data loss or file system damage. Therefore, do not run CHKDSK when running other programs, such as Microsoft Windows.
(2) The CHKDSK cannot be used to allocate the drive and network.
CHKDSK cannot be used for drive operations formed by SUBST commands, nor for disk checks on network drives.
(3) physical disk error
The CHKDSK command can only find logical errors in the file system, rather than physical disk errors. To locate physical disk errors, use the SCANDISK program.
(4) Bad disk sectors
In the CHKDSK report, the bad sectors are marked as "bad", and SCANDISK and other physical disk error correction programs mark the bad sectors as "bad". Therefore, the bad sectors are not harmful.
(5) Cross-linked files
If two files or directories share the same disk space, CHKDSK will report a cross-link file. If the CHKDSK finds that a cross-link file exists, the following information is displayed:
Is cross linked on allocation unit
CHKDSK does not fix cross-link files, even if/F is specified. To fix the cross-link file, you need to run the SCANDISK program, or manually repair the file, copy it to the specified file, and delete the original file.
VII. Application Instances
(1) Save the CHKDSK status report to a file
You can redirect the CHKDSK status report to a file to save it. However, do not use the/F toggle when redirecting the CHKDSK status report to the file. For example, to output the CHKDSK check information to the CHK. LIS file, the command is: C: DOS> CHKDSK
A:> CHK. LIS.
(2) If you check how much data is stored on disk C, how much space is available, and correct disk errors, run the following command:
Chkdsk c:
When an error occurs, CHKDSK pauses and prompts a message.
(3) Searching for files
You can use the CHKDSK and FIND commands in combination with the Pipeline Function to FIND all files. This command format not only lists the directories where the files you are searching are located, but also lists files with the same name in each directory, even implicit files are no exception. It is worth noting that before using this command, you should first use the CHKDSK/F parameter to correct disk errors. For example, to find the README file on drive C, the command format is as follows:
C:> CHKDSK/VIFIND "README"