Errors in disk media and in the
file system can cause a wide range of Windows problems, ranging from an
inability to open or save files to blue-screen errors and widespread
data corruption. Windows is capable of recovering automatically from
many disk errors, especially on drives formatted with NTFS.
To perform a
thorough inspection for errors, you can manually run the Windows Check Disk utility,
Chkdsk.exe. Two versions of this utility are available—a graphical
version that performs basic disk-checking functions, and a command-line
version that provides a much more extensive set of customization
options.
To check for errors on a local
disk, follow these steps:
Open
Computer, right-click the icon belonging to the drive you want to
check, and then choose Properties from the shortcut menu. On
the Tools tab, click Check Now. (If you're using a standard account,
you'll need to supply credentials for an account in the Administrators
group to execute this utility.)
In the Check Disk dialog box, shown next, select from the
following options:
Automatically Fix File
System Errors
This option, which is enabled by default, configures Windows to
automatically repair any errors it detects in the file system. If this
option is not selected, Check Disk reports any errors it finds but does
not correct them. This option is the equivalent of running the Chkdsk
command with the /F switch, as described later in this section. Scan For And Attempt
Recovery Of Bad Sectors Select this option to perform an exhaustive check
of the entire disk, locate bad sectors, and recover readable information
stored in defective locations. Note that selecting this option
automatically repairs file system errors as well, even if the previous
option is cleared. This option is the equivalent of running the Chkdsk
command with the /R switch.
If you simply want to see a report of file system errors
without making any changes to disk structures, leave both boxes
unselected. Click Start to begin the
disk-checking process. The green progress bar provides feedback as the
error-checking tool goes through several phases. If you select the Automatically Fix File System Errors option on a
drive that currently has open files, Windows is unable to run the utility
immediately. In that case, you see the message shown here:
Click
Schedule Disk Check to configure Windows startup so that the disk check
utility runs the next time the computer is started. The disk check occurs early in
the startup sequence, before Windows shifts into graphical mode; during
this period, your computer is not available for you to perform any
other tasks. When your computer starts, Windows notifies you that it's
about to perform a scheduled disk check; by default, you have 10 seconds
to cancel the operation and boot normally instead. After Check Disk completes its operation, it reports its
results. If the disk check turns up no errors, you see a Disk Check
Complete dialog box. If Check Disk uncovers any errors, it writes a message to the
System event log and displays a dialog box listing the errors it found
and the repairs it made.
Warning:
Although Check Disk
is a useful tool and sometimes a lifesaver, it can cause you headaches
if used without some planning. After it has started, the Check Disk
operation cannot be stopped except by pressing your computer's power
switch. On large drives (hundreds of gigabytes or more), the full disk
check can take hours or even days to complete.
Check Disk runs
automatically after an abnormal
shutdown only if a specific bit in the registry is set, indicating that
the file system is "dirty"—that is, that some pieces of data were not
properly written to the disk when the system was shut down. If the file
system wasn't doing anything when the system shut down, the dirty bit
will not be set. Because NTFS volumes keep a journal of all disk
activities, they are able to recover and remain clean even if you shut
down in the middle of a disk write. Check Disk is most likely to run
automatically at startup only on FAT32 volumes, after an unexpected
shutdown.
Two additional and
well-hidden Windows commands are crucial to the operation of the Check Disk utility.
The first of these, Autochk.exe,
runs automatically any time you specify that you want to schedule a
disk check to run at startup; it cannot be run interactively. The
second, Chkntfs.exe,
is especially useful if you change your mind and decide you want to
cancel a scheduled
check. At a command prompt, type chkntfs /x
d: (where d is replaced by a
drive letter) to exclude the drive specified. Chkntfs has another nifty
trick: it can tell you whether a disk is dirty. At a command prompt,
simply type chkntfs
d:.
For more details about these commands, see Knowledge Base article
218461, "Description of Enhanced Chkdsk, Autochk, and Chkntfs Tools in
Windows 2000" (w7io.com/2103)
and Knowledge Base article 160963, "CHKNTFS.EXE: What You Can Use It
For" (w7io.com/2104). These Knowledge Base articles were
originally written for earlier versions of the operating system, but the
information is still valid for Windows 7.
|
The command-line version
of Check Disk gives you considerably more options. It also allows you
to set up regular disk-checking operations using the Task Scheduler. To run this command in its
simplest form, open a Command Prompt window using the Run As
Administrator option, and then type chkdsk at the prompt. This command runs Chkdsk in
read-only mode, displaying the status of the current drive but not
making any changes. If you add a drive letter after the command (chkdsk d:, for instance), the report
applies to that drive.
You can use any
combination of the following switches at the end of the command line to modify its operation:
/F
Instructs Chkdsk to fix
any errors it detects. This is the most commonly used switch. The disk
must be locked. If Chkdsk cannot lock the drive, it offers either to
check the drive the next time you restart the computer or to dismount
the volume you want to check before proceeding. Dismounting is a
drastic step; it invalidates all current file handles on the affected
volume and can result in loss of data. You should decline the offer.
When you do, Chkdsk will make you a second offer—to check the disk the
next time you restart your system. You should accept this option. (If
you're trying to check the system drive, the only option you're given is
to schedule a check at the next startup.) /V On FAT32 volumes, /V displays
verbose output, listing the name of every file in every directory as the
disk check proceeds. On NTFS volumes, this switch displays cleanup
messages (if any). /R Identifies bad sectors, and recovers information from those
sectors if possible. The disk must be locked. Be aware that this is a
time-consuming and uninterruptible process.
The following
switches are valid only on NTFS volumes:
/I Performs a simpler check of index entries (stage 2
in the Chkdsk process), reducing the amount of time required. /C Skips the checking of cycles within the folder structure,
reducing the amount of time required. /X Forces the
volume to dismount, if necessary, and invalidates all open file handles.
This option is intended for server administrators. Because of the
potential for data loss, it should be avoided. /L[:size] Changes the size of the file that logs NTFS
transactions. If you omit the size parameter, this switch displays the current
size. This option is intended for server administrators. Because of the
potential for data loss, it also should be avoided in normal use. /B Reevaluates bad
clusters.
When you run Chkdsk in the Windows Recovery
Environment, some options are not available
The Chkdsk command used when you boot to the Windows Recovery
Environment is not the same as the one used within a full Windows
session. Only two switches are available for this version:
If your system is able
to boot to Windows either normally or in Safe Mode and you suspect that
you have disk errors, you should use the full Chkdsk command.
|
|