3

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?

3 Answers3

3

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

Synetech
  • 69,547
3

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.

1

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!

jidar
  • 740