Vista Scan and Fix

USBDLM

 

Vista / Windows 7 "Scan and Fix"


 

When a FAT formatted "removable" USB drive is attached then under Vista and Win7 the "Scan and Fix" dialog is often shown.

 

After executing this "Scan and Fix" (never seen it really finds an error) it shall not be shown again, but in real life it happens that is comes again and again...

 

 

Why?

 

A look at the FAT partition's boot sector reveals that the "Scan and Fix" is shown when there is a certain bit set. When this bit is set back to 0 then "Scan and Fix" is not shown anymore.

 

USBDLM can do exactly this:

 

[Settings]

PreventVistaScanAndFix=1

 

 

What exactly does USBDLM?

 

This aforesaid bit is found in a value with the very meaningful name "BS_Reserved1", see Microsoft's FAT32 File System Specification (fatgen103.doc).

 

Usually its value is 0, when "Scan and Fix" was trigged you will find a 1 there.

 

When a new USB drive is attached then USBDLM looks for a FAT partition and resets the value to 0 in its bootsector. If this succeeds before Windows reads the value then "Scan and Fix" is not shown. Usually it works well, but sometimes Windows is too fast...

 

Of course this suppresses the symptom only. It is far better to prevent having this "dirty bit" set.

 

As far as I have discovered, Windows sets the bit whenever a file size is changed and when a file is created or deleted.

Here is my dirty bit watch tool: WatchFatDirtyBit.zip

 

Under Windows 7 It is set back to 0 about 1.5 Seconds after a file size change but very long 30 Seconds after a file was deleted or created! Having a write cache active or not seems to have no effect on the dirty bit handling under Windows 7. But this there are very first results, more research is to come...

 

So, if you delete a file on a FAT formatted USB drive and remove it within 30 Seconds then you have set dirty bit.

Just always use "Eject" or the "Safely remove hardware" facility, this flushes all data and sets the bit back to null.