Home > Commands A-M > Commands Ch-Cz

CHKDSK


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Checks the status of a disk and displays a status report. Can also fix disk errors.

The status report shows errors found in the operating system 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 /?

CHKDSK [drive:][[path]filename] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]]

Display the current drive disk status:

CHKDSK


Parameters
drive: (v2.0 Win95 NT3.1)
Specifies the drive that contains the disk that you want CHKDSK to check.
[path]filename (v2.0 Win95 NT3.1)
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.
Specifies the directory to which you want to change.

Switches
/? (NTXP)
Display help.
/C (NT2000)
NTFS only: Skips checking of cycles within the folder structure.
Reduces the amount of time required to run Chkdsk by skipping certain checks of the volume.
/F (v2.0 Win95 NT3.1)
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. In general, when fixing disk errors, use ScanDisk instead of CHKDSK.
If you specify the /F switch, chkdsk will show an error if open files are found on the disk.
If you use chkdsk /F on a very large disk or a disk with a very large number of files (millions), chkdsk may take a long time to complete. The computer will not be available during this time, as chkdsk does not relinquish control until it is done.
If the drive is the boot partition for NT, you will be prompted to run the check during the next boot.
To issue ckdsk on a hard drive you must be a member of the Administrators group.
/I (NT2000)
NTFS only: Performs a less vigorous check of index entries.
Reduces the amount of time required to run Chkdsk by skipping certain checks of the volume.
/L[:size] (NT4)
NTFS only: Change the log file size to the specified number of kilobytes. If size is not specified, displays the current log size and the drive type (FAT or NTFS).
/R (NT3.1)
Locates bad sectors and recovers readable information (implies /F).
/V (v4.0 Win95 NT3.1)
On FAT/FAT32: Displays the full path and name of every file on the disk.
On NTFS: Displays cleanup messages if any.
/X (NT2000)
Forces the volume to dismount first if necessary. All opened handles to the volume would then be invalid (implies /F).

Related

SCANDISK - GUI based Disk Repair.
CHKNTFS - schedule CHKDSK to run at boot time.
Equivalent Linux BASH commands:
cksum - Print CRC checksum and byte counts (can detect problems but not fix them)


Notes
Format of status reports

The operating system displays CHKDSK status reports similar to:

    Volume DISK1PART01 created 12-06-1998 7:35p
    Volume Serial Number is 4F8D-2A5B
      201,031,680 bytes total disk space
        8,769,536 bytes in 49 hidden files
          851,968 bytes in 194 directories
      176,619,520 bytes in 2,546 user files
       14,790,656 bytes available on disk
            4,096 bytes in each allocation unit
           49,080 total allocation units on disk
            3,611 available allocation units on disk
          647,168 total bytes memory
          588,304 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:

    10 lost allocation units found in 3 chains.
    Convert lost chains to files?

If you press Y, the operating system 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, the operating system 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 the operating system 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 operating system 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:

    File is cross linked on allocation unit nnn;
    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.


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.


SCANDISK repairs disks when CHKDSK fails

The command-line tool CHKDSK is not as capable as the GUI tool SCANDISK. Under NT SCANDISK is only available from the GUI in NT Explorer - select a drive, choose Properties then "Check For Errors"

I have more than once seen SCANDISK repair a disk where CHKDSK failed.

A good strategy is to schedule an AT job to detect any disk problems by running CHKDSK - then use SCANDISK to manually fix any problems as they occur.


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:

    CHKDSK C:

CHKDSK pauses and displays messages if it encounters errors.

To redirect the output of CHKDSK to a file named STATUS, type:

    CHKDSK A: > status

Because the output is redirected, the operating system 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.


Errorlevels
Availability
Internal
DOS
v1.0 v1.05 v1.1 v1.11 v1.24 v1.25 v1.85 v2.0 v2.01 v2.05 v2.10 v2.11 v2.11R v2.12 v2.2 v2.25 v3.0 v3.20 v3.05 v3.1 v3.21 v3.25 v3.30 v3.3A v3.3R v3.3T v3.31 v3.40 v4.0 v4.01 v4.01A v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10 v8.00
Windows
Win95 Win98 WinME
Windows NT
NT3.1 NT3.5 NT3.51 NT4 NT2000 NTXP NT2003

Last Updated: 2006/12/01
Direct corrections or suggestions to: Rick Lively