CHKDSK has been around since before the days of Windows. This utility has in some ways changed dramatically for new environments and new disk formats. Yet in other ways, it’s pretty much the same old disk checking utility that we’ve been using since the days of DOS.
Regardless of its age or origins, CHKDSK is an important tool for disk maintenance and recovery (in some cases) from a variety of disk-related issues.
Let’s run CHKDSK.
CHKDSK on a non-system drive
The simplest usage of CHKDSK is on a drive that is not your system (Windows) drive.
In Windows Explorer, right-click on the drive you want to check.
ClickProperties. In the resulting dialog box, click the Tools tab.
Click the Check now… button.
There are two options presented before CHKDSK begins its work:
- Automatically fix file system errors. If not checked, CHKDSK will simply report,but not fix, any problems that it finds.
- Scan for and attempt recovery of bad sectors. This is a more time-consuming scan of the disk that I’ll discuss below.
In general, the default setting is fine when you suspect there is a problem that needs to be fixed.
Click Start, and you may get this message:
CHKDSK can only check or repair a disk when it is the only program using that disk; even the rest of Windows cannot be accessing the disk while CHKDSK does its job. Forcing a dismount makes that happen. If a program is actually accessing the drive or files on the drive about to be dismounted, the old “results are unpredictable” phrase applies. Programs may simply notice and do the right thing; they may crash or something inbetween.
That’s why the common advice is to close most programs when running CHKDSK, or at least make sure none can access the drive you’re about to check.
Click Force a dismountand CHKDSK begins its work.
Eventually, this is the message you hope to see:
“See details” displays a log of CHKDSK’s activity. Any errors to be repaired would be listed here.
CHKDSK on a system drive
Remember how I said CHKDSK requires exclusive access to the drive in order to be able to repair it? And that even Windows can’t be accessing the disk?
That presents a problem when you want to CHKDSK the system drive – typically your C: drive. If Windows is running, then by definition, it accesses the system drive nearly constantly.
The solution is to run CHKDSK before Windows runs.
If you attempt to CHKDSK your system drive, instead of getting the option to dismount it (not something that can be done while Windows is running), you’ll get amessage offering to run the CHKDSK before Windows is loaded the next time you reboot.
Click Schedule disk check. Now, reboot your machine. As the machine reboots, you’ll see something like this before Windows loads:
Once completed, Windows will load normally.
Getting the results of a scheduled CHKDSK
A very common question is where to get the results of a CHKDSK that ran before Windows started. There’s no pause, and the information shown above disappears as soon as Windows starts to boot.
Run the Event Viewer by clickingStart, and then Run, (or type Windows Key + R). Enter in eventvwrand click OK.
In Event Viewer, click the Applicationlog under “Windows Logs”.Look for the line item that ends with Wininit (for Windows Initialization) and has “Checking file system on C:” in the lower General tab.
To make reading the results easier, just double-click on that Wininit line.
The scrolling box near the top contains the results of CHKDSK that scrolled past on the screen before Windows loaded.
CHKDSK via command line
CHKDSK is a command-line tool. All of the options above simply run that same tool in some way that captures its output.
You can do that directly yourself.
Click on Start, All Programs, Accessories, and then right-clickCommand Prompt.
ClickRun as administrator,becauseCHKDSK does require administrative access to do its job.
In the Command Prompt, type:
…to run CHKDSK with the “/F” or “fix” parameter. Without /F, CHKDSK will simply report, but not repair, any errors.
As you can see, the example above checks the D: drive, and just as in the windowed interface, CHKDSK must dismount the drive before it can be checked.
If you run CHKDSK against the C: drive,
…it similarly requests that the CHKDSK be scheduled at the next reboot.
So what does CHKDSK check?
It’s difficult to describe exactly what information CHKDSK checks without getting lost in the geekery of file system details and hard disk layout. Essentially, it checks the organizational and overhead information on a hard disk that allows Windows to locate and access the files stored on that disk.
One analogy might be to think of a hard disk as a kind of simple telephone book.
By default, CHKDSK reads through all the listings and makes sure they all have a name and a properly formatted telephone number. If a street address is present, CHKDSK might also ensure that the address is also properly formatted and represents a real address in the area that the phone book is supposed to cover.
If problems are found and CHKDSK has been asked to repair things, it might take actions like removing invalid phone numbers, or perhaps adding a proper area code or country code that was supposed to be there in the first place–but only if it can infer from other information what the right answer should be. Similarly, it might try to fix a physical address, but has the option of removing that information if it can’t come up with what it should have been.
In fact, it’s possible for CHKDSK to simply remove entries that are so garbled that its proper values can’t be figured out.
Scanning for bad sectors? That’s sort of like calling every phone number in the book and making sure that it rings through to a real phone. It might not be the right person answering, but the phone number works at some basic level.
Scanning for bad sectors
Normally, CHKDSK simply checks that the information stored on the disk is correct. There’s a fair amount of overhead information that tells Windows where files are located and how they’re actually stored and distributed around the disk media. CHKDSK uses its knowledge of what this information is supposed to look like to ensure it’s correct and try to fix it when it’s not.
Scanning for bad sectors is another thing entirely. When this option is selected, CHKDSK actually reads the entire disk, not just the overhead information. As a result, a bad sector scan takes significantly longer than a simple CHKDSK.
As CHKDSK reads, it notices if those reads actually succeed. When they do not, it marks the area that failed as “bad” so that the system won’t attempt to write more information into those areas with problems.
It’s important to note that this scan doesn’t test whether the data found is good or valid–only that it can in fact be read.
As we saw earlier, scanning for errors is a simple checkbox when you run CHKDSK from Windows Explorer. For those that prefer the command line, it’s the “/R” – repair – option.
When to CHKDSK
Normally, CHKDSK only need be run when a problem is suspected.
In particular, a scan for bad sectors only needs to be done once you’ve actually encountered a bad sector – usually in the form of a bad read, write, or explicit CRC error. CHKDSK will do what it can, but most importantly, it will remove the bad area from use.
Running CHKDSK to simply check the validity of the file system is a quicker operation, and it’s not unreasonable to run it every so often, particularly if your machine has been crashing. In most cases, Windows will actually force a CHKDSK after a system crash or improper shutdown. This is done not to fix the cause of the crash (although in some cases it could), but rather to fix any disk-related issues that may have resulted from the crash.
What CHKDSK won’t do
While we talk about CHKDSK “repairing” a hard disk, it is not a data recovery tool per se. Its job is not to recover lost or damaged files, but to ensure that the information currently on the disk is in a consistent and safe state.
When it comes time to search for files accidentally lost or deleted, then you need to use tools like Recuva and similar.
If you’re trying to recover data from a hard drive that has a persistent media problem, or is so damaged that a CHKDSK scan for bad sectors can’t help, then a tool like SpinRite might be your only option.
Unless, of course, you have a backup and can simply replace your failing hard drive.