Author Topic: "Turn off Windows write-cache buffer flushing" is a Dangerous setting  (Read 20845 times)

Offline BenYeeHua

  • Volunteer User Moderator
  • Member#
  • *****
  • Posts: 2243
  • Gender: Male
TR:DR:Don't play with Dangerous setting which has some warning words for it, just leave it as default and you might be safe. ;D

From the Topic - Why you should ALWAYS remove devices safely...
http://bitsum.com/forum/index.php?topic=2401.0
You should know that write cache can be dangerous thing, except you remove the devices safely. :)
(As I know, Windows has disable write cache for the removable devices, and anything can be happen.)

But, Hard Disk can also has some write cache issues, and it is worst than that.

Dangerous setting is dangerous: This is why you shouldn't turn off write cache buffer flushing
http://blogs.msdn.com/b/oldnewthing/archive/2013/02/28/10397976.aspx#10398441
http://blogs.msdn.com/b/oldnewthing/archive/2013/04/16/10411267.aspx
http://blogs.msdn.com/b/oldnewthing/archive/2010/09/09/10059575.aspx
Quote
Hello!

This post will be 100% off topic but since your are on a Windows development team I thought I would let you know.

We have discovered that the "turn off windows write-cache buffer flushing on the device" option (enabled) causes data loss on reboot when installing Windows updates. We had at least four incidents when our PCs became unbootable since crucial Windows files were wiped out on reboot.

I wonder if your team could investigate this issue and release a fix for it.

Thank you.
[Dangerous setting is dangerous. -Raymond]
Yes, a normal restart can be also causing the data damaged, as the Hard Disk don't flush the hard disk's RAM cache and write the data into the medium completely.
It just tell windows it has been "write" finish in the hard disk's RAM.

And luckily Windows devs found this issues, and has some special command for it, to ask for the real one.(If you don't tick that setting just like what's has been done by that person.)
Quote
This extra "flush out your internal RAM buffer too" command is the right thing to do, but it can safely be skipped under very special circumstances: Consider a hard drive with a power supply separate from the computer which can keep the drive running long enough to flush out its internal RAM, even in the event of a sudden total loss of external power. For example, it might be an external drive with a separate power supply that is hooked up to a UPS. If you have this very special type of set-up, then Windows doesn't need to issue the "please flush out your internal RAM buffers too" command, because you have a guarantee that the data will make it to the disk no matter what happens in the future. Even if a transformer box explodes, cutting off all power to your building, that hard drive has enough residual power to get the data from the internal RAM buffer onto the physical medium. Only if your hard drive has that type of set-up is it safe to turn on the Turn off Windows write-cache buffer flushing on the device check box.

(Note that a laptop computer battery does not count as a guarantee that the hard drive will have enough residual power to flush its RAM buffer to physical media. You might accidentally eject the battery out of your laptop, or you might let your battery run down completely. In these cases, the hard drive will not have a chance to finish flushing its internal RAM buffer.)
But, Hard Disk can lies. :o
Quote
Having worked for a company that makes disk drives, I am amused.  Steering clear of the dangerous setting doesn't guarantee that you won't get corruption in a power outage.  Lots of hard drives cheat and do write caching internally--even when the protocol doesn't allow for it.  The drive simply lies to the OS, and says, yeah, those bits are stored.  Kill the power too soon, and the lie will be exposed.
- Adrian
Quote
[Windows tells the drive to flush, and then since it knows that drives lie about flushing, it sends another command saying, "now flush for real, stop pretending". But apparently (according to Adrian above), some drives ignore even this extra bonus flush request, and then you're kind of screwed. -Raymond]
http://blogs.msdn.com/b/oldnewthing/archive/2013/04/16/10411267.aspx#10411500

So, when Windows has been help you prevent that and using another command for it(which is controlled by this setting), your Hard Disk might be also lies to this command. >:(
And there are no way to know about that, except you cut down the power to "test" for it. :P

Just the answer for this Topic, don't enable and playing with some Dangerous setting, except you don't care for your data.
And hope that Hard Disk can accept/support the command, not lies for it to getting better performance, as this is what Windows/User want. :)
---
Maybe someone will asking that, just give it some time to let it write completely.
But.
Quote
Joshua and Raymond's comments weren't there when I typed the previous one. Anyway, isn't it possible to make the hard disk device driver delay shutdown for five minutes or so?
["Sir, you have to turn off your laptop before we can take off." "Yes, I know. Just four minutes, thirty seconds remaining." -Raymond]
Did you really want this? ;D
Why not just let the Hard Disk telling the true answer?



Offline edkiefer

  • Volunteer User Moderator
  • Member#
  • *****
  • Posts: 1643
  • Gender: Male
there 2 setting under HD .
there enable write caching on this device and then sub option of  Turn off Windows write-cache buffer flushing .
I personally have write caching enabled but not Turn off Windows write-cache buffer flushing .

I forget if this was default or I set it .
Bitsum QA Engineer

Offline BenYeeHua

  • Volunteer User Moderator
  • Member#
  • *****
  • Posts: 2243
  • Gender: Male
there 2 setting under HD .
there enable write caching on this device and then sub option of  Turn off Windows write-cache buffer flushing .
I personally have write caching enabled but not Turn off Windows write-cache buffer flushing .

I forget if this was default or I set it .
Yes, this is the default setting. :)
After you update the AHCI driver, like IRST(IntelĀ® Rapid Storage Technology), it will reset to default setting.

And this is why I will check for this dangerous setting. ;)

Offline Jeremy Collake

  • Administrator
  • Member#
  • *****
  • Posts: 5207
  • Gender: Male
  • The Lasso
    • Bitsum
Interesting. It seems this is a hardware issue with the on-board hard drive cache, as opposed to a bug with Windows. It's no surprise that hard drive manufacturers are 'cheating' when it comes to forcing a flush of the write-back cache. They want to score high on benchmarks.

I personally have a UPS on my system, so disable write cache flushing for my hard drives. However, the actual performance impact is probably negligible in most cases. I am not feeling like explaining this statement, but you can probably imagine how - on modern PCs with *typical* I/O patterns - this setting doesn't really boost performance much. Still, I use it .. every bit counts.


Software Engineer. Bitsum LLC.

Offline BenYeeHua

  • Volunteer User Moderator
  • Member#
  • *****
  • Posts: 2243
  • Gender: Male
I think the UPS don't fix this issues(file loss when shutdown), as when you shutdown the computer, the hard disk will also cut the power down. :)
----
And yes, we collect the optimize bit by bit, and it will become a bigger one. ;)
But not using this way too much for software, as you "might" wasting the time for collecting it.