CHKDSK
Encyclopedia
CHKDSK is a command on computers running DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

, OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 and Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 operating systems that displays the file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

 integrity status of hard disk
Hard disk
A hard disk drive is a non-volatile, random access digital magnetic data storage device. It features rotating rigid platters on a motor-driven spindle within a protective enclosure. Data is magnetically read from and written to the platter by read/write heads that float on a film of air above the...

s and floppy disk
Floppy disk
A floppy disk is a disk storage medium composed of a disk of thin and flexible magnetic storage medium, sealed in a rectangular plastic carrier lined with fabric that removes dust particles...

 and can fix logical file system errors. It is similar to the fsck
Fsck
The system utility fsck is a tool for checking the consistency of a file system in Unix and Unix-like operating systems such as Linux.-Use:...

 command in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

.

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 computers running NT-based
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 versions of Windows, CHKDSK can also check the disk surface for physical errors or bad sector
Bad Sector
Bad Sector is an ambient/noise project formed in 1992 in Tuscany, Italy by Massimo Magrini. While working at the Computer Art Lab of ISTI in Pisa , he developed original gesture interfaces that he uses in live performances: 'Aerial Painting Hand' , 'UV-Stick' Bad Sector is an ambient/noise...

s
, a task previously done by SCANDISK
SCANDISK
SCANDISK or ScanDisk is a utility in MS-DOS and Microsoft Windows systems which checks and repairs file systems and bad clusters on the hard drive. It was introduced in MS-DOS version 6.2...

. This version of CHKDSK can also handle some physical errors and recover data that is still readable.

Windows NT-based CHKDSK

CHKDSK can be run from the Windows Shell
Windows Shell
The Windows shell is the main graphical user interface in Microsoft Windows, and since Windows 95 hosted by Windows Explorer. The Windows shell includes well-known Windows components such as the Taskbar and the Start menu...

, the Windows Command Prompt or the Windows Recovery Console
Recovery Console
The Recovery Console is a feature of the Windows 2000, Windows XP and Windows Server 2003 operating systems. It provides the means for administrators to perform a limited range of tasks using a command line interface. Its primary function is to enable administrators to recover from situations...

. One option for CHKDSK is the use of the Command-line/R parameter, which allows the program to repair damage it finds on the hard drive.

Conducting a CHKDSK can take some time, especially if using the /R parameter, and the results are often not visible, for various reasons. The results of a CHKDSK conducted on restart using Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...

 or later operating systems are written to the Application Log, with a "Source" name of Wininit or Winlogon and can be viewed with the Event Viewer
Event Viewer
Event Viewer, a component of Microsoft's Windows NT line of operating systems, lets administrators and users view the event logs on a local or remote machine. In Windows Vista, Microsoft overhauled the event system.- Overview :...

. On the Windows 7 operating system, look for events with 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 unofficially supported but 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 Vista. Clears the list of bad clusters on the volume and rescans all clusters for errors (implies /r).
/? Displays the list of available CHKDSK switches.


When running CHKDSK from the Recovery Console
Recovery Console
The Recovery Console is a feature of the Windows 2000, Windows XP and Windows Server 2003 operating systems. It provides the means for administrators to perform a limited range of tasks using a command line interface. Its primary function is to enable administrators to recover from situations...

 the options are different. The /p is not read-only as in the standard version but corrects errors :
/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.


A typical result:


Checking file system on C:
The type of the file system is NTFS.

A disk check has been scheduled.
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.


Vista result (App Event Log) found in "bootex.log" in the root folder of the drive:


Checking file system on C:
The type of the file system is NTFS.

A disk check has been scheduled.
Windows will now check the disk.
79232 file records processed.
332 large file records processed.
0 bad file records processed.
2 EA records processed.
44 reparse records processed.
105198 index entries processed.
0 unindexed files processed.
79232 security descriptors processed.
Cleaning up 1 unused index entries from index $SII of file 0x9.
Cleaning up 1 unused index entries from index $SDH of file 0x9.
Cleaning up 1 unused security descriptors.
12984 data files processed.
CHKDSK is verifying Usn Journal...
35789792 USN bytes processed.
Usn Journal verification completed.
Windows has checked the file system and found no problems.

78175231 KB total disk space.
12902428 KB in 54029 files.
36068 KB in 12985 indexes.
0 KB in bad sectors.
187407 KB in use by the system.
65536 KB occupied by the log file.
65049328 KB available on disk.

4096 bytes in each allocation unit.
19543807 total allocation units on disk.
16262332 allocation units available on disk.

Examples

To CHKDSK a USB drive (or other drive) use chkdsk e: /r where e would be your external drive letter.

The MS-DOS 5 bug

The version of CHKDSK (and Undelete) supplied with MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

 5.0 has a bug which can corrupt data. This applies to CHKDSK.EXE and UNDELETE.EXE with a date of 04/09/91 (April 9, 1991). If the file allocation table
File Allocation Table
File Allocation Table is a computer file system architecture now widely used on many computer systems and most memory cards, such as those used with digital cameras. FAT file systems are commonly found on floppy disks, flash memory cards, digital cameras, and many other portable devices because of...

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 gives more details on this.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK