CHKDSK

From Wikipedia, the free encyclopedia

CHKDSK (8.3 command shortening of Checkdisk) is a command in DOS and Microsoft Windows systems which verifies a hard disk or a floppy disk for file system integrity. It is similar to the fsck command in Unix.

Contents

[edit] Usage

By default, CHKDSK neither fixes errors nor checks for bad sectors. In order to fix errors while using the command line interface, the /F parameter should be specified. In order to check for and mark bad sectors, the /R parameter should be specified. Other parameters can be listed by typing the command chkdsk /?

[edit] Windows XP

Under Windows NT, Windows 2000, and Windows XP, CHKDSK can also check the disk surface for bad sectors, a task previously done by SCANDISK. CHKDSK can also fix errors.

[edit] Running CHKDSK

Under Windows, CHKDSK can be run both from a console window, as the chkdsk command with flags, and from My Computer using the graphical user interface. For the latter,

  • Open My Computer
  • Right-click with the mouse on the disk or diskette to scan
  • Click Properties
  • Click the Tools tab
  • Press the Check Now... button in the Error-checking box
  • In the box that opens, check boxes allow the same functionality as the command line's /R and /F parameters

When used under Windows with the /F or the /R parameter when there are open files on the disk (for instance if running it on the boot disk) CHKDSK suggests it be run on the next restart. If the user agrees, it will execute autochk.exe when the computer is restarted, which will run the CHKDSK code.

Sometimes the check still fails, giving the error "Cannot open volume for direct access" on startup, due to an application (anti-virus, anti-spyware, firewall, and the like) that locks up the partition before CHKDSK can access it. This has been improved in Service Pack 2, but still happens occasionally. One fix is to set the "/SAFEBOOT" option in the boot.ini tab after running msconfig.[1] This puts the system in a minimal/low-resolution mode temporarily, though, which can be disconcerting but does not mean that anything has broken.

If the check does not occur and does not provide any error messages, this may be due to a corrupt copy of autochk.exe. A clean copy can be copied from C:\i386 to C:\WINDOWS\SYSTEM32 or from your Windows Installation CD.

[edit] Using the Recovery Console

When using the Recovery Console, the CHKDSK command can use the following options:

/p : Does an exhaustive check of the drive and corrects any errors.
/r : Locates bad sectors and recovers readable information.

Note: If you specify the /r option, the /p option is implied. When you specify the chkdsk command without arguments, the command checks the current drive with no options in effect.

[edit] Viewing results

Conducting a CHKDSK can take some time, especially if using the /R parameter, and the results are often not visible, for various reasons. In order to view the results of a CHKDSK conducted on restart using Windows XP or Windows 2000,

  • Open the Control Panel
  • Double click on Administrative Tools
  • Double click on Event Viewer
  • Click on Application (Windows XP) or Application Log (Windows 2000) from the left hand side of the window
  • Find items labeled Winlogon under the Source column (clicking the Source column heading sorts the entries alphabetically)
  • Results of CHKDSKs on restart can be found in the Winlogon entries. They can be viewed by double-clicking. Look for one with the correct date and time.

A typical result:

Checking file system on C:
The type of the file system is NTFS.
Volume Serial Number is 5761-7BC0
Windows is verifying free space...
Free space verification is complete.
Windows has checked the file system and found no problems.

    526106624 bytes total disk space.
        57344 bytes in 7 hidden files.
       131072 bytes in 16 folders.
     51421184 bytes in 171 files.
    474497024 bytes available on disk.

         8192 bytes in each allocation unit.
        64222 total allocation units on disk.
        57922 allocation units available on disk.


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp .

[edit] The MS-DOS 5 Bug

The version of CHKDSK (and Undelete) supplied with MS-DOS 5.0 has a serious bug which can corrupt data. This applies to CHKDSK.EXE and UNDELETE.EXE with a date of 04/09/91. If the file allocation table of a disk uses 256 sectors, running CHKDSK /F can cause data loss and running UNDELETE can cause unpredictable results. This normally affects disks with a capacity of approximately a multiple of 128 MB. This bug was fixed in MS-DOS 5.0a. A Microsoft Knowledge Base article [1] gives more details on this.

[edit] See also

[edit] External links

References:

  1. ^ Microsoft Knowledge Base article about the MS-DOS 5.0 CHKDSK bug
In other languages