I figured that this would be a good place to ask this question…
We have patched the HAL ReturnToFirmware code in Windows NT such that a
“shutdown” command really does power off the machine automatically.
We discovered though that the disk write cache was getting lost when we did
that.
We then stuck in a 2-second delay, and the problem seems to have gone away
in our limited testing.
My question is: How long should we wait to give the disk a chance to flush
its cache in the worst case (full cache, all over the disk)? I know that
the exact time will vary from disk to disk, but I imagine that there’s a
sensible amount of time that would make sense.
Clearly 2 seconds seems to be good enough for our typical system, but I’d
like to solve the problem in general instead of it coming back when we
change hard drive manufacturer, model, and so on.
I’ve checked a few disk datasheets with 2 MB write caches, and they seem to
agree that 350 ms AFTER A SLEEP/STANDBY COMMAND is enough time if there are
no errors. However, from what I can see of the standard Windows NT
ATAPI.sys driver, it does NOT issue a SLEEP/STANDBY when shutting down, so
I’m not sure if that changes the timing or not – it seems to me that would
depend on how aggressive / lazy the write cache really is?
I asked tech support at a disk drive company and they gave me some various
per-sector numbers that ended up being 14 MINUTES with a full cache –
clearly, that number does not make sense, but the tech support person really
couldn’t give me a better answer.
Any suggestions / comments / opinions?
Thanks in advance!