I have a Windows 7 laptop that I have been unable to defragment for the last several months.

When I try to invoke the defragmenter from the command line it says "The dirty bit is set on this volume". So I have tried to force it to defragment on the next reboot but that never happens.

When I try to invoke the defragmenter UI I get a dialog which says "Disk Defragmenter was scheduled using another program" and presents me with a "Remove settings" button which apparently has no effect.

I can't delete the scheduled task even when I run Task Scheduler as Administrator, I get a message that says "Transaction support within the specified resource manager is not started or was shut down due to an error"

Any suggestions on how to get the win7 defragmenter to run? I am aware that 3rd party defragmenter solutions exist.

  • Run a chkdsk to see if there's any disk/filesystem corruption. Then run SFC /scnanow and see if that repairs any missing/corrupted system files. – Ƭᴇcʜιᴇ007 Aug 29 '14 at 15:30

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 file.

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:

  1. Reboot your computer and allow the disk to be checked.
  2. Run chkdsk c: /F to attempt to fix any errors.
  3. 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.

  • A good answer but unfortunately it doesn't help in my case as the chkdsk never happens at boot despite having scheduled it several times. The local IT admin thinks it has something to do with the 3rd party full disk encryption software in use – wytten Sep 2 '14 at 12:01

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.