Check Disk (chkdsk)
The disk optimizer and Disk Cleanup utilities provide methods to
handle poorly performing disks within a computer; chkdsk (pronounced
“check disk”) performs disk repair to help correct problems with the
drives themselves.
Chkdsk is a command-line utility designed to correct errors found in
hard disks; Windows IT professionals have used it since MS-DOS. The
utility previously required many of the operations it performed to be
executed when the computer started. This ensured that the files chkdsk
scanned would not be in use by other programs and that they could be
modified or acted on by the utility.
This made a very lengthy startup process because chkdsk would run
and work to repair the disk, depending on the selected options, and
then Windows would start. In many cases, running chkdsk was helpful,
but when weighed against the cost of startup time, it became a last
resort.
Windows 8 has improved the performance of the chkdsk
utility greatly. It can now perform most of its repair actions while
the computer is online, avoiding the additional startup time. Table 1 outlines the optional command-line switches used with chkdsk.
Table 1. Chkdsk optional command-line switches
Command Line Switch |
Description |
Volume |
Type the drive letter and a colon, mount point, or volume name to check. |
Filename |
Specify the files that should be checked for fragmentation (FAT or FAT32 file systems only). |
/F |
This switch fixes errors found on the disk. |
/V |
This switch displays the full path name of every file found (FAT or FAT32 only). |
/R |
This switch displays cleanup messages; if necessary, locates bad
sectors; and recovers readable information. /F is implied when /scan is
not specified on NTFS drives. |
/L:size |
This switch modifies the size of the log file for the operation to
the specified number of kilobytes. If no size is specified, the current
size is displayed (NTFS only). |
/X |
This switch forces a volume being scanned to dismount before being
scanned if necessary. This closes all open handles to the volume. |
/I |
This switch checks index entries for a volume less intensely (NTFS only). |
/C |
This switch skips checking cycles within the folder structure (NTFS only). |
/B |
This switch re-evaluates clusters on the specified volume; it implies /R (NTFS only). |
/scan |
This switch scans the volume online (NTFS only). |
/forceofflinefix |
This switch disables online repair. Any items found will wait until
the computer is restarted to be repaired. This requires /scan (NTFS
only). |
/perf |
This switch uses more resources to complete a scan as quickly as possible. It requires /scan (NTFS only). |
/spotfix |
This switch runs spot fixes on the specified volume (NTFS only). |
/sdcleanup |
This switch performs garbage collection for unneeded security descriptor data; /F is implied (NTFS only). |
/offlinescanandfix |
This switch runs both the scan and fix operations offline. |
Open a command prompt as an administrator. Run the command with no options by typing chkdsk
on the command line; it will scan the drives in your computer and
display the results. Using the utility without the /F switch executes
it in read-only mode so no changes will be made to your system.
Note
BENEFITS OF THE SPOTFIX FEATURE
Using the Spotfix feature can help correct issues on nonsystem
volumes without the need to restart. This is monitored by the Action
Center in Windows 8 to help ensure less downtime for a computer for
maintenance.
Chkdsk runs in several phases when it executes a scan. The phases happen in the following order:
-
File system structure
-
File system indexes
-
Security descriptor
-
USN journals
First, the general file system is checked to ensure the absence of critical issues there. When that completes, the indexes for the files are checked and corrected (depending on the options). Last, the chkdsk utility examines security descriptors, to ensure that permissions and access objects for files are not out of order, and USN journals, where any changes to the volume are stored.
The scan findings are displayed in the command prompt
window and provide a lot of information about what chkdsk found when it
ran. Figure 7 shows results from a chkdsk scan.
When all the checks have been completed, the results of the process are displayed for review. Information reported includes:
-
Verification of files on the disk
-
Verification of file indexes
-
Verification of security descriptors
-
Information about total disk space available
-
Total space used by files, indexes, logs, and bad sectors
Windows 8 automates many of the chkdsk
operations to provide a proactive maintenance environment for your
computer. The utility can be used from the command line to ensure
optimal file performance, but in many cases Windows alerts you if a
problem needs your attention.