Files on your hard disk live in folders; folders can live in other folders; the whole mess lives in your disk, which might actually be a partition on a larger hard disk. On top of that, there may be security information about who is allowed to access what and in what ways they're allowed to access it.
As you can imagine, things get pretty confusing. All that you probably care about is that you get what you expect when you access a file.
The fact is that there's a lot of information on the hard disk that helps keep track of all of the data that's being stored there. CHKDSK's primary job is to make sure that all of that administrative information about the files, folders, and other stuff that's stored on the disk is correct.
Normally, all of that information is correct. The system is designed to keep it correct from startup to shutdown.
Unfortunately, a variety of errors can cause it to be incorrect; things like not shutting down your computer properly, removing USB devices without using Safely Remove, malware, or just flat out hardware errors can cause errors in the administrative information on the hard disk.
CHKDSK's job is to try and repair those errors.
What's a 'command line' tool?
Most programs in Windows appear as ... well, as or in a window.
Command line tools do not. They don't know about on-screen windows and don't display their results in them. They rely on the Windows "Command Prompt", which is nothing more than a non-windowed environment that mimics the days before Windows where all programs were "command line" tools under MS-DOS.
And it's with a Command Prompt that we'll start.
Running CHKDSK
You'll find Command Prompt in your Start menu, under All Programs - Accessories.
Click that and you'll get a new window that looks much like this:
Command line tools are run by typing in the command with any options and pressing the Return key. Any output that the tool then generates shows up in the window underneath what you've typed.
Try it now: after opening a Command Prompt window or clicking it to make it active, just type CHKDSK followed by the Enter key. You should see something similar to this:
Access Denied as you do not have sufficient privileges.
You have to invoke this utility running in elevated mode.
C:\Users\LeoN>
Our first problem: CHKDSK requires that you not only be administrator, but that you run the program as administrator. The two are not the same.
Type EXIT followed by Enter to close this Command Prompt. We need a new one.
Running CHKDSK as administrator
Head back to Start, All Programs, Accessories, and this time, right-click Command Prompt:
This time, click Run as administrator. You may get prompted to confirm.
After clicking OK, you'll get a Command Prompt window that's very similar to the one that you had before; except that now, not only does the window have full administrative privileges, but any program that runs within it inherits that permission.
Try that CHKDSK again.
Without any parameters (I'll describe a few in a moment), CHKDSK does nothing more than check. It won't attempt to fix anything; it'll simply report whether it finds any problems.
After displaying a fair amount of technical information about its progress, CHKDSK will finish with a report similar to this:
Windows has checked the file system and found no problems. 33449983 KB total disk space. 13811900 KB in 46164 files. 34088 KB in 12870 indexes. 0 KB in bad sectors. 255651 KB in use by the system. 65536 KB occupied by the log file. 19348344 KB available on disk. 4096 bytes in each allocation unit. 8362495 total allocation units on disk. 4837086 allocation units available on disk.
That first line is good news. If you want to see what precedes that, you can use the scroll bar to the right in the Command Prompt window.
CHKDSK parameters
By default, CHKDSK operates on the "current" disk, which in almost all of the cases that we're seeing here would be C:. To have CHKDSK check a different drive, simply follow the CHKDSK command with a space, and then the drive designator:
CHKDSK D:
Would check your D: drive.
To actually have CHKDSK fix any problems that it finds, you'd include the "/F" (Fix) parameter:
CHKDSK D: /F
This would check the D: drive; if any errors were found, CHKDSK would attempt to repair them. The results would be included in the on-screen output.
Finally, the next most common action for CHKDSK is to actually check for bad sectors. That's the "/R" (Repair) option:
CHKDSK D: /R
When running /R, CHKDSK will check the entire disk surface for bad sectors and attempt once again to repair or work around any that it finds, if it can. Running /R also does /F as well.
The special case of C:
C: is special. (More correctly, your system drive is special, but in most cases, that's C:.) The problem is that your system is using C:, and CHKDSK can't repair things while they're in use. Run CHKDSK /F and you're likely to see this:
The type of the file system is NTFS. Cannot lock current drive. 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)
The step to take is to answer with Yes and then reboot your system. CHKDSK will run before Windows starts so that it can repair the drive before Windows starts using it.
Most common usage
The most common ways to use CHKDSK are:
-
CHKDSK /F - to check and fix the current drive (a reboot might be required)
-
CHKDSK D: /F - to check and fix a specific drive
-
CHKDSK D: /R - to check and fix and look for bad sectors on a specific drive
You can also run CHKDSK /? to get a list of additional options.