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.
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.
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:
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:
- How to Share File or Folder in Windows 10
- Backup and Restore Network Shares in Windows 10
- Enable SMB1 Sharing Protocol in Windows 10
- Create Shared Folders Shortcut in Windows 10
- Change File Sharing Encryption Level in Windows 10
- Disable or Enable File and Printer Sharing in Windows 10
- Disable Password Protected Sharing in Windows 10
- How to View Network Shares in Windows 10
Via Ned Pyle.
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!