I have an external USB hard drive that Windows 7 doesn't properly recognize as being a USB device, it thinks it's a regular internal drive. As such, it won't let me eject it, and I've been using an ad-hoc method of removing the drive letter via Computer Management in order to ensure the drive isn't being accessed when I disconnect it.

The problem with this is that Windows frequently refuses to let me write to the drive because it thinks it was disconnected improperly. Running chkdsk clears the dirty volume flag (or whatever it is that it's relying on), but it never finds any actual errors. It's a completely pointless exercise.

How can I prevent Windows from doing this?


Can't add this as a comment to Synetech's answer (rep too low) but you can, indeed, find the dirty bit and clear it using a hex editor. It's a bit hair raising, though (Find a bit pattern that looks like this one, which hopefully isn't actual data, then twiddle it from 1 to 0.)

Linux gparted/parted or ntfsresize also apparently know where the dirty bit is, because they set it as soon as you touch an NTFS partition.

| improve this answer | |
  • > Hilarious. You're a prince. ;) And you’re a cowboy. :-D – Synetech Feb 15 '12 at 18:28
  • Nice. I’m not surprised that somebody eventually found it—though why Microsoft purposely kept it secret is beyond me. (I just wish I hadn’t been too busy and given up on it.) :-P – Synetech Feb 15 '12 at 18:30
  • Actually, the dirty bit is at different places depending on the filesystem and version of the OS (and in fact, there may be more than one): [1], [2], [3]. – Synetech Feb 24 '12 at 18:26

See this page for details on the dirty bit.

There is no apparent way for them to clear the dirty bit.

This is confirmed by the many pages that discuss using fsutil, but end up agreeing that it can only set the bit, not clear it and that the only way to clear it is to run chkdsk. The page goes on to say that

Microsoft has never released the location of the dirty bit, so they are stuck.

(That’s interesting because a long time ago, I actually tried to identify where it was located but gave up pretty quickly. That note has stoked my interest in finding it again.)

In any case, I would not recommend arbitrarily just clearing the dirty bit. I would suggest finding a way to get the drive to work as expected instead. First off, have you set the drive’s policy in the Device Manager? Open the Device Manager (devmgmt.msc) and double click your drive and disable Write Caching in the Policies tab (if Optimize for quick removal is not disabled, select that as well).

| improve this answer | |
  • There is unlikely to be a way to prevent it from being set or acted upon without hacking the guts of Windows. – Synetech Feb 15 '12 at 18:27
  • Well if they purposely kept it secret, meaning that they don’t want users to be able to control it, then I doubt they would have made it easy. :-( – Synetech Feb 15 '12 at 18:34

Sounds to me like you should try to get the device set as a removable device so you don't have this problem in the first place! Thankfully, we've already had a community response.

USB stick appearing as hard disk drive, not removable storage device

Hope this helps!

| improve this answer | |

Your Answer

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