I've run chkdsk /F
many times over the years...and today I had to run it on one of my 2008 R2 servers and I get the normal message:
Chkdsk cannot run because the volume is in use by another process. Would you like to schedule this volume to be checked the next time the system restarts? (Y/N) y
This volume will be checked the next time the system restarts.
I've looked at the Technet doc here: http://technet.microsoft.com/en-us/library/cc730714.aspx as well as normal google searching and searching on Technet and site:microsoft.com on google, but can't find what I'm looking for...
The Question:
HOW/where does Windows schedule this on restart? It isn't in Task Scheduler or RunOnce or similar, which makes sense if it needs to run before Windows locks the volume...so where exactly does Windows set this "scheduled task" to occur so that the server knows about it even a week later during a maintenance window reboot?
Great Question. the answer is that the
VolumeDirty
bit is set on the volume, which (I have to assume) is checked during bootup. Probably similar to the way it's checked when a flash drive is inserted and one gets the popup that says Scan or Continue Without Scanning.I once tried to come up with a way to schedule a chkdsk for an automated server that had near zero maintenance, by setting the
volumedirty
bit via powershell script (dirtybitset = $true
), but it wouldn't work. I may revisit that as it appears from my link there's a ScheduleAutoChk that does just that and works in conjunction with the dirtybit.Further research here states:
More info about
autochk.exe
can be found here to help explain what is going on in Microsoft Technet site and Wikipedia, where Wikipedia states:Specifically it appears if you look in the registry under:
There is a value of
BootExecute
that gets changed fromautocheck autochk *
to something likeautocheck autochk /p \\??\C: autocheck autochk *