Write Cache - Tech Info Only
Disk write caching is a feature that improves system performance by using fast volatile memory (RAM) to collect write commands sent to data storage devices and cache them until the slower storage device (ex: hard disk) can be written to later. This allows applications to run faster by allowing them to proceed without waiting for data write-requests to be written to the disk.
While disk write caching may increase system performance, it can also increase the chances of data loss in case of power or system failures before the data from the write-cache buffer is flushed by writing the data to the disk.
See KB33.56 Write Cache Technical
Dangerous setting is dangerous: This is why you should turn off write cache buffer flushing!
Okay, about the Write-Caching policy settings...
This dialog box takes various forms depending on what version of Windows you are using.
Notice that the warning text gets more and more scary each time it is updated. It starts out just by saying, "If you lose power, you might have data loss or corruption." Then it adds a recommendation, "Recommended only for disks with a backup power supply." And then it comes with a flat-out directive: "Do not select this check box unless the device has a separate power supply."
The scary warning is there for a reason: If you check the box when your hardware does not satisfy the criteria, you risk data corruption.
But it seems that even with the sternest warning available, people will still go in and check the box even though their device does not satisfy the criteria, and the dialog box says right there do not select this check box.
And then they complain, "I checked this box, and my hard drive was corrupted! You need to investigate the issue and release a fix for it."
Dangerous setting is dangerous.
At this point, I think the only valid "fix" for this feature would be to remove it entirely. This is why we can't have dangerous things.
*Interestingly the Disk Management help makes it sound a lot less scary:
"If high data transfer performance is your paramount concern, you should enable both settings: in the Removal Policy section, select the Better Performance option and in the Write-caching policy section, select Enable write caching on the device (if the system hardware and storage device support these features) … If your system or power source has known issues with sustaining power, you should not use these features."
?????More Conflicting Information...
Turn Off Windows Write-Cache Buffer Flushing: Don’t do this. If you disable this feature, you could lose data in the case of a power failure. Windows itself tells you only to disable this feature if your drive has a separate power supply that allows it to flush its data and save it to disk in case of a power failure. In theory, this could speed up some SSDs, but it could slow down other SSDs, so it’s not even a guaranteed performance improvement. Stay away from this option.
Enable, Disable Disk Write Caching in Windows 10/8/7
Disk Write Caching is a feature that improves system performance by enabling write caching on the device. It is a feature, which is available on almost all disk drives these days. The benefit of Disk Write Caching is that it allows applications to run faster by allowing them to proceed without waiting for data write-requests to be written to the disk.
Let’s say you save a file. Now when you save it, Windows makes a note that you want to save the file on your hard drive. This information is saved temporarily in Windows memory, and it will write this file to hard drive later on. After the file is written to the hard drive, the cache will send an acknowledgment to Windows that the file has been written to the hard drive and it can now be safely removed from cache.
Disk Write Caching does not actually write data to the hard disk drive, It occurs after some time, after some time. But in case of a power outage or system failure, the data can get lost or corrupted. So while disk write caching may increase system performance, it can also increase the chances of data loss in case of power or system failures.
If you see the following error messages, you might want to check if disabling Disk Write Caching helps:
Windows Write Delay Failed
Delayed Write Failed.
Disable or Turn off Disk Write Caching
If you wish, you can turn off Disk Write Caching on your Windows computer. You can enable or disable this feature through the Disk Management snap-in.
Follow this procedure to disable Disk Write Caching. Open Computer folder > C Drive > Properties > Hardware tab > Select the Disk Drive > Click on Properties button > Policies tab.
SSD Optimization Tweaks to Increase SSD Performance
1. Ensure your SATA ports are configured to use AHCI mode in BIOS
Still relevant? Yes, but typically on older systems
Generally, the SATA interface can be toggled to work in either IDE (Integrated Drive Electronics) or AHCI (Advanced Host Controller Interface) mode. AHCI mode will run significantly faster so it’s important that your SSD is running in this mode. In older systems, the BIOS may default the SATA ports to IDE mode, but in newer systems, it should default to AHCI mode.
If you’re running an older system and upgrading to a SSD, be sure to check to ensure you’re running in AHCI mode for best performance. As all motherboard BIOS/UEFI systems are slightly different, consult your motherboard manual on how to do this or request some help from our community forums. Be sure to enable AHCI mode PRIOR to installing Windows or you may end up with a BSOD as soon as you change the mode.
Those running PCIe SSDs do not need to do this.
2. Enable TRIM
Still relevant? Not really, but make sure it’s running
TRIM is a command developed specifically for SSDs to tell SSDs to wipe out deleted data to improve performance the next time data is written. With Windows 10, TRIM should be enabled by default for SSDs, so this shouldn’t be a problem.
However, since it’s super easy check whether TRIM is enabled, I’d still highly recommend checking. Here’s how to do it.
Click Start, in the search bar type “cmd”, right click “Command Prompt” and click “Open as Administrator”
Type “fsutil behavior query DisableDeleteNotify” without the quotes
If you get DisableDeleteNotify = 0 then TRIM is working. If you get DisableDeleteNotify = 1, then simply type “fsutil behavior set disabledeletenotify 0” without the quotes to enable TRIM.
3. Disable PageFile
Still relevant? Depends
Previously, the biggest benefit of disabling the pagefile was simply to free up the storage space reserved for the pagefile. With SSD prices now hovering in the $0.20-$0.30/GB range, it’s much more affordable than ever to purchase 256GB or higher capacity SSDs. If you’re still rocking a 64GB SSD or smaller, I’d still recommend disabling the pagefile for storage if you have greater than 4GB of onboard memory, but if you’ve got an appropriately sized SSD, it’s not worth the effort.
4. Disable Superfetch and Prefetch
With the introduction of Windows 8 and Windows 10, SuperFetch, Prefetch, ReadyBoost is automatically disabled on SSDs by default making it no longer necessary to disable these features.
5. Disable Indexing
Previously I recommended simply disabling the Windows File Index entirely and calling it a day, but it’s much easier to simply adjust what Windows Indexes through the Index Options. This way you can simply index files that you want indexed such as files stored on a hard drive or very frequently accessed files on your SSD.
Here’s how to access your Indexing Options.
In the search bar search for ‘Indexing Options’ and click on it
Click on ‘Modify’
Choose which directories you’d like indexed
6. Disable System Restore
Like disabling the pagefile, the biggest benefit to disabling system restore is getting back some storage space. However, with SSDs coming down significantly in price, setting aside some storage space for system restore is no longer as much of an issue as with 64GB or smaller SSDs. If you’re still one of those rocking a smaller capacity SSD, this might be a great way for you to free up a couple GB worth of data.
Here’s how to disable system restore.
Right click Start
Click “System Protection”
Highlight your SSD (Usually Drive C:)
Click “Disable system protection”
Click Yes when prompted
7. Disable Hibernation
On the same token as disabling the pagefile and disabling system restore, disabling hibernation is another one of those tricks to help you free up some drive space. Unlike standby mode which most of us are familiar with, hibernation mode allows a system to go into deep sleep by storing your Windows session in primary storage rather than DRAM. This unfortunately will require some storage space and could be an issue if you’re running out of drive space.
Disabling hibernation is easy. Here’s how to do it.
In the search bar type “cmd”
Right click “Command Prompt” and click “Run as Administrator”
Type “powercfg /hibernate off”
8. Turn off Windows Write Cache Buffer Flushing
For those who like to live on the edge, turning off the Windows write-cache buffer flushing will prevent Windows from waiting for the buffer to flush to the drive before writing additional data. While this may provide a performance boost, it has a good chance of causing Windows corruption if the system experiences sudden power loss or some sort of random shutdown.
If you have a laptop with an integrated power supply or a desktop running on a UPS and are looking for maximum performance above all else, you can consider doing this. Otherwise, I’d recommend not turning off Windows write-cache buffer flushing.
Here’s how to disable Windows write-cache buffer flushing.
Right click Start
Click ‘Device Manger’
Click ‘Disk Drives’
Right click your SSD
Click ‘Policies’ tab
Tick ‘Turn off Windows write-cache buffer flushing on the device’
Windows has gone a long way since the days of Windows XP and Windows 7, and Microsoft has done a lot of work under the hood to ensure that SSDs operate at their best performance. As the SSD evangelist that I am, I get plenty of questions on how to ensure SSDs are performing at their best and hopefully this article answers some of those questions. If you have additional questions, feel free to swing by our community forums for additional help.
Did this article help you? SSD experts out there, do you know of any additional optimizations? Let us know in the comments below!
April 16, 2013 at 8:22 am
I must say, "my system or power source has known issues with sustaining power" is a really nice way of saying "yeah, blackouts/brownouts are pretty common over here".
Alternatively, the advanced features could be put under "if you have known issues with due diligence and taking personal responsibility, you should not use these features".
April 16, 2013 at 8:39 am
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.
April 16, 2013 at 8:51 am
<At this point, I think the only valid "fix" for this feature would be to remove it entirely>
Enter BIOS manufacturers. Lately they have nice graphic interface, with a mouse, with a 3D image of mobo, heck you can even have a internet browser integrated there. And they have also this dangerous settings in there. Except they bluntly put it there without the slightest warning. Don't know who gets the last word, OS or BIOS, when it comes to this, but if is BIOS that would be fun (fun for data recovery labs, cause they will get work).
April 16, 2013 at 9:00 am
As for the writeup by Raymond and what the other guy was complaining about, I'm surprised that Windows doesn't flush all buffers /on controlled poweroff/ whatever the setting on the drive is.
Took me twice to see it. Expectation on reading that is unexpected disk poweroff will lose data. I would not expect a shutdown from the OS to do the same.
[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]
April 16, 2013 at 9:29 am
Sven, I think you're right. The poster that Raymond jeers at with ‘And then they complain …’ was complaining that writes got lost even though the power didn't fail. Still don't see why he would complain here, but then again, it isn't always easy to figure out how to complain to big organisations.
April 16, 2013 at 9:34 am
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]
April 16, 2013 at 9:54 am
For all those talking about UPS and generators and such, you're missing the point of the setting. The assumption is that the PC power supply has lost its power… UPS and generators have already run their course, and have depleted themselves. At this point, the ONLY option to save the data that exists in cache but has not yet persisted to disk, is through some form of BBU (common on RAID arrays).
Since this is specific to drives, why shouldn't future drive connectivity (IDE/SATA/etc) specs include a flag/field to indicate whether the battery is present. Perhaps an extended SMART capability would also enable battery condition monitoring, to disable the feature if the battery is dead, or to scale the amount of caching with the condition of the battery. Windows could first start by tuning the setting during install… extend to tuning it during bootup… then possibly continuous tuning with daily/hourly scheduled tasks (though I'm not sure the battery condition would change enough to warrant this, and it may or may not be possible to change the setting without a reboot).
April 16, 2013 at 9:56 am
[But apparently (according to Adrian above), some drives ignore even this extra bonus flush request, and then you're kind of screwed. -Raymond]
That sucks. Microsoft could theoretically stop this practice by testing for it and publishing a big list of all drive models that fail. Will they do it? Probably not. It it their problem? No.
April 16, 2013 at 10:01 am
I agree it's hilarious.
Still, if you don't wait for the drive to flush you risk data corruption. Since Windows and applications write a lot during shutdown, you have a simple choice. Data loss or patience. Of course, the user really shouldn't have bought a shitty drive, but I bet the device's non-compliance wasn't mentioned in its advertisements.
In the mind's eye it would lead to a wonderful scenario when someone buys a laptop and straight away brings it onto a plane without giving it a spin. But in practice the flight attendant would just say they don't care about your hung computer – just hold down the power button. Which is just where you would have been.
But if the user has used the thing before, he'll know from experience that it takes X minutes to shut it down, while Windows says ‘⊚ Waiting for hard disk drives to flush…’
BrightCandle, May 18
As a programmer when I flush the write buffer I really mean it, its important that this happen when I tell it to for the proper functioning of my software. Its not just basic data integrity its also that the software and its critical sections needs the write to have been done before the critical section is left. Disabling this would make some of the software I have written in the past misbehave and crash in strange ways. Its not a good idea to disable this ever as I can't be the only developer that writes software with multiple threads where a lock is used to ensure the sanity of the system when writing and reading files concurrently, infact I know I am not.