Advertisement

Enable Write Through In Windows 10 For Reliable Network Data Transfers

Windows 10 like all previous versions of the OS includes the SMB protocol (Server Message Block) for networking with other devices. SMB is used for file and printer sharing. In version 1809, Microsoft has added a Write Through option for the SMB protocol to Windows 10, which significantly improves the reliability of network transfers, and guarantees that data is written back to the actual storage medium.

Advertisement


All disk drives, whether they are hard disk drives or solid state drives, come with a built-in cache which is a temporary (volatile) high speed memory to store data but not retain it unless it is actually written to the disk. Writing data to the disk takes time compared to reading-writing it from a cache since it is extremely fast. This method markedly increases the throughput of storage operations.

SSDs use the cache even more aggressively than HDDs. Windows employs cache flushing. This means that the system will periodically instruct the storage device to transfer all data waiting in the cache to the principal storage media.

In Windows Device Manager, you can control whether this disk cache is used on not. Enabling the use of the cache improves performance but a power failure can result in data loss. Further, you can also control write-cache buffer flushing in situations where data integrity is important.

Policy Tab Disk Properties In Device Manager

Enable Write Through In Windows 10

In Windows 10 version 1809 and Windows Server 2019, Microsoft has finally added this write through cache control for storage transfers over SMB. Both the classic NET.exe utility and the modern PowerShell cmdlet New-SmbMapping have been updated with the option to set this flag on the client device in the network.

In write-through caching, the device operates on write commands as if there were no cache. The cache may still provide a small performance benefit, but the emphasis is on treating the data as safely as possible by getting the commands to the principal storage. The main benefit is that you can remove the storage device from the system or from the network quickly without risking data loss.

The NET tool now supports the option NET USE WRITETHROUGH.

The appropriate PowerShell command is: New-SmbMapping -UseWriteThrough.

They allow you to map a drive with forced unit access ("write through") specified and bypass all OS caches, forcing the I/Os through to disk.

Previously this useful feature was available only on cluster shares on Windows file servers with the Continuous Availability flag set, and SMB3, starting in 2012.

The change made to Windows 10 makes it possible to force it from the client side and it doesn’t matter what Windows version or configuration is being used, nor the SMB version as long as it is at least SMB 2.0.

So, enabling Write Through feature will guarantee that data is written back to the drives. If your file server restarted at the tail end of a huge file write, the data won't be lost from the cache; it’s safe as it's written to disk.

Also, you will be able to see your actual storage performance on copy file writes.

To learn more about file, folder and printer sharing, see the following articles:

Via Ned Pyle.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

4 thoughts on “Enable Write Through In Windows 10 For Reliable Network Data Transfers”

  1. New-SmbMapping : Missing an argument for parameter ‘UseWriteThrough’. Specify a parameter of type ‘System.Boolean’ and
    try again.
    At line:1 char:16
    + New-SmbMapping -UseWriteThrough
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [New-SmbMapping], ParameterBindingException
    + FullyQualifiedErrorId : MissingArgument,New-SmbMapping

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.