CHKDSK
A component of Microsoft Windows | |
---|---|
Chkdsk.exe in action on drive C: | |
Details | |
Type | Utility software |
Included with | DOS, OS/2 and Windows |
Related components | |
Microsoft ScanDisk (Co-existed with Chkdsk in Windows 9x and MS-DOS 6.x) |
CHKDSK (short for "check disk") is a system tool in DOS, OS/2 and Windows. It verifies the file system integrity on hard disks or floppy disk and fixes logical file system errors. It is similar to the fsck command in Unix.
The command is implemented as an executable program file, CHKDSK.EXE. Different operating systems all use the same filename, but the files are not necessarily compatible between operating systems.
On Windows NT operating systems, CHKDSK can also check the disk surface for bad sectors and mark them. In MS-DOS 6.x and Windows 9x, this is a task done by Microsoft ScanDisk. Windows Server version of CHKDSK is RAID-aware and can fully recover data in bad sectors on a disk in a RAID-1 or RAID-5 array if other disks in the set are intact.[1]
CHKDSK can be run from DOS prompt, Windows Explorer, Command Prompt or Recovery Console.
In Windows NT
Conducting a CHKDSK can take some time, especially if using the /R
parameter, which causes CHKDSK to attempt to recover data, and the results are often not visible, for various reasons. The results of a CHKDSK conducted on restart using Windows 2000 or later operating systems are written to the Application Log, with a "Source" name of Wininit or Winlogon, except on some instances of the Windows 7 operating system, where the events may have a "Source" name of "Chkdsk".
The standard version of CHKDSK supports the following switches:
filename | FAT only. Specifies the file or set of files to check for fragmentation. Wildcard characters (* and ?) are allowed. |
path | FAT only. Specifies the location of a file or set of files within the folder structure of the volume. |
size | NTFS only. Changes the log file size to the specified number of kilobytes. Must be used with the /l switch. |
volume | FAT and NTFS (NTFS support is unofficial, but it works normally). Specifies the drive letter (followed by a colon), mount point, or volume name. |
/c | NTFS only. Skips checking of cycles within the folder structure. |
/f | Fixes errors on the volume. The volume must be locked. If CHKDSK cannot lock the volume, it offers to check it the next time the computer starts. |
/i | NTFS only. Performs a less vigorous check of index entries. |
/l[:size] | NTFS only. Displays current size of the log file. If size is specified, changes the log file to that size (in kilobytes). |
/p | Checks disk even if it is not flagged as "dirty" (only available in the Recovery Console). |
/r | Locates bad sectors and recovers readable information (implies /f and /p). Unreadable data is lost. If CHKDSK cannot lock the volume, it offers to check it the next time the computer starts. |
/v | On FAT: Displays the full path and name of every file on the volume. On NTFS: Displays cleanup messages, if any. |
/x | NTFS only. Forces the volume to dismount first, if necessary. All opened handles to the volume are then invalid (implies /f). |
/b | NTFS only, since Windows Vista. Clears the list of bad clusters on the volume and rescans all clusters for errors (implies /r). |
/? | Displays the list of available CHKDSK parameters. |
When running CHKDSK from the Recovery Console the options are different. The /p is not read-only as in the standard version but corrects errors:[2]
/p | Fixes errors on the volume. Same as the /f option in standard CHKDSK. |
/r | Locates bad sectors and recovers readable information (implies /f and /p). Takes much longer to run than /p by itself. |
CHKDSK requires the drive not to be locked. Therefore, after a command prompt with the syntax
chkdsk [volume]: /[switch] /[switch] ... /[switch]
if the drive cannot be locked, CHKDSK prints:
Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N)
If "y" is selected, CHKDSK will run on restart. If it does so, it prints that a disk check has been scheduled, i.e.
A disk check has been scheduled. Checking file system on C: The type of the file system is NTFS. Windows will now check the disk. Cleaning up minor inconsistencies on the drive. Cleaning up 318 unused index entries from index $SII of file 0x9. Cleaning up 318 unused index entries from index $SDH of file 0x9. Cleaning up 318 unused security descriptors. CHKDSK is verifying file data (stage 4 of 5)... File data verification completed. CHKDSK is verifying free space (stage 5 of 5)... Free space verification is complete. 14996645 KB total disk space. 10187752 KB in 88054 files. 30784 KB in 5774 indexes. 0 KB in bad sectors. 164341 KB in use by the system. 65536 KB occupied by the log file. 4613768 KB available on disk. 4096 bytes in each allocation unit. 3749161 total allocation units on disk. 1153442 allocation units available on disk.
In Windows Vista or Windows 7, CHKDSK's output will be piped to the App Event Log found in "bootex.log" in the root folder of the drive.
The MS-DOS 5 bug
CHKDSK and UNDELETE in MS-DOS 5.0 have a bug which can corrupt data: 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 applies to CHKDSK.EXE
and UNDELETE.EXE
with a date of 04/09/91 (April 9, 1991). This bug was fixed in MS-DOS 5.0a.[3]
See also
References
- ↑ Holm, Dan; Thomas, Orin (2003). "11-3: Maintaining Disk Storage Volumes". Managing and Maintaining a Microsoft Windows Server 2003 Environment. Microsoft Press. p. 11.25. ISBN 9780735614376.
- ↑ Recovery Console article on Microsoft Knowledge Base
- ↑ Microsoft Knowledge Base article about the MS-DOS 5.0 CHKDSK bug
Further reading
- "Chkdsk". TechNet Library. Microsoft. Retrieved 6 February 2014.
- "An explanation of the new /C and /I Switches that are available to use with Chkdsk.exe". Support (4.4 ed.). Microsoft. 1 December 2007.
- "Troubleshooting Disks and File Systems". TechNet. Microsoft. 3 November 2005.
|