The Dirty Bit

Status
Not open for further replies.

WalnutMon

Solid State Member
Messages
13
I have heard alot about the "dirty bit" and how it applies and works in applications... Word, or Excell for example. But how does the dirty bit on the Hard drive work? and how does Chkdsk know when to run???
 
ok, so i have been around the block a few times, and so asking this I'm bound to feel stupid, but What in the Sam Hell are you talking about? Dirty bit?
 
the "dirty bit" is a bit, that can be either set (1) or cleared (0). I am at least pretty sure that is how that goes. It is used by the operating system windows to to decide if it is going to run chkdsk. If the "dirty bit" is set then it will run due to an improper shutdown or something like that. However, it is a little more complicated to figure out how exactly this bit gets set and that is what I am hoping to find out... Perhaps that explanation will at least send someone down the right road...
 
more than likely this "dirty bit", and I've not heard that term either... is a setting within the registry using using algorythms to determine its setting. If you know much in programming then think of it like setting a do while/do while not/ do until/If statements. Say, forexample, its set to monitor the system time. If the system time equals a certain time, then set this bit to 1, else its 0. Then the program that monitors that bit setting says, oh you just changed your state... this is what I'm supposed to do... and then it does its designated runtime.
 
"dirty bit" is actually something that is implemented by windows. It is used in two ways, read and write caching and for maintaining the integrity of a hard drive. The latter is the use I am interested in... somehow windows knows when your computer has been shutdown improperly, and sometimes, based on whether your partition, or disk volume is "dirty", runs chkdsk. What I don't understand is how the computer knows when to flip that dirty bit, and if there are more than one used for this purpose. go to your comand prompt (if your running XP) and type in "fsutil dirty query c:" or whatever your drive is and it will return either "C: is NOT dirty" or "C: is dirty". You can also set the dirty bit to one by typing "fsutil dirty set c:". At that point you set the dirty bit and the only way it can go back is by running checkdisk at start up. This will not do any damage to your computer, try it, its a good way to schedule checkdisk... although just schueduling a check disk is just as well... and then we get to use the fun chkdsk operators!
 
ok, so I think I understand what you are looking for.
First the Checkdisk stuff is just flagged by two ways.
1. You set it to run, which alters the bootup mode, setting a DOS like command switch.
2. You shut the system down hard or reboot hard and then the system wants to see if everything is ok.
The second one is the one you are refering to as the dirty bit. All that is happening here is when the system shuts down normally, there are entries made in the HKLM registy hive indicating such, as well as the primary system files are released as clean. But when that doesn't happen, they system reacts to it, due to the "Dirty bit" which is just a flag indicating improper closure . IN windows 98 all the way up thought XP it works in basically the same way.
This site dicusses this a bit.
http://www.mvps.org/vb/hardcore/html/thedirtybit.htm
this as well
http://www.mcse.ms/message778952.html
and this too
http://www.microsoft.com/windowsxp/...sxp/home/using/productdoc/en/fsutil_dirty.asp
 
that's is pretty much what I stated above walnutmon... it knows this by setting a bit in the registry by using something similar to algorythms in programming. So If you turn windows off, it WILL have enough time to flip that bit in the registry to a 1, when windows starts it will see that setting of 1, will run the appropriate commands and then run scandisk. at the end of this scandisk it will get a command to reset that bit to a value of 0. All done by algorythms.
 
The problem with the explanation I have gotten from most websites on this bit is that they say that certain conditions, such as pending file moves, and other possibly dangerous operations, set the bit to 1, and then after they conclude are set back to 0... that is why when you hard power down your computer sometimes check disk runs, and sometimes it doesn't... it won't run checkdisk if you were not doing something potentially harmful. However, if you set the "dirty bit" using fsutil, it will run check disk, no matter what you do. So there must be secondary "dirty bits" because if there were not then when you set the dirty bit to 1, after the windows shut down it would clear to 0. So under what condition is that bit actually set to 1 by the operating system... sometimes I wish I just said, yeah, hehe
 
ah, now I got what your asking. well, I'm sure its probably in the registry as a reg value somewhere.
 
1. Make sure CheckDisk is not enabled in your startup list - if it is,
uncheck it:

Start / Run / Msconfig / Startup


2. Clear your BootExecute entry:

Start / Run / regedt32

HKEY_LOCAL_MACHINE / SYSTEM / CurrentControlSet / Control / Session
Manager
BootExecute

-Delete all autocheck entries, especially: autocheck autochk /f *


HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows NT /
CurrentVersion / Winlogon

-Highlight the Winlogon file.

-Set "SFCScan" to 0 (zero).

Hopefully one of those will help.
 
Status
Not open for further replies.
Back
Top Bottom