Raymond Chen (long time Windows developer) explains the dirty bit here:
One mystery that has gone unsolved for the longest time now is the
dirty bit on hard drive volumes. Basically a dirty bit is just a 1 hex
value located somewhere hidden on the hard drive that Microsoft has
never reveal until recently. Windows will check the dirty bit to
determine if a volume can contain corrupted files due to hard
resetting your Windows computer with files that are still opened or
when you unplug a USB flash drive that is in the midst of copying a
When the computer boots up with the dirty bit enabled on a hard drive,
you will be asked to check the disk for consistency before Windows is
loaded. You can skip the disk checking by pressing any key but it will
come back again the next time you start up your computer. This will
usually keep happening until you let the drive be scanned or
alternatively you can tell Windows to stop checking the specific
drive. This method doesn’t clear the dirty bit on the drive though and
simply forces Windows not to scan a drive on boot.
So, assuming that the dirty bit is set (which you can use
fsutil dirty query c: to find out) then you have three options:
- Reboot your computer and allow the disk to be checked.
chkdsk c: /F to attempt to fix any errors.
- Use a hex editor/alternative boot CD to manually set the bits on the drive (found on page 2 of his article).
Personally I'd probably just reboot the computer as it ensures that there is nothing running that could prevent the scan from happening.
Once the dirty bit has been unset, you should be able to run the defragment program.
Side note: Use
fsutil dirty set c: if you want to manually set the dirty bit on drive C. There is no way to use
fsutil to unset it though.