Hard Drive – How Frequently Does Windows Flush Write Cache?

hard drivehard-drive-cache

Assuming a file transfer completes, how long does it take until windows flushes the write cache?

For example I run a backup on a hard drive (with write caching enabled). Once the backup is complete I turn off the drive. Does the write cache get flushed immediately once disk i/o has finished or is there a waiting period?

Best Answer

Windows flushes its internal file cache on an eight-second rotating window. That is, every second, one-eighth of the dirty pages in the cache are queued for writing. The actual writing may take longer. Also, other factors may cause the writes to be delayed.

The drive's own on-board cache, as well as Windows' cache, is guaranteed to be flushed when you go through the "safely disconnect" dialog. It won't tell you "safe to remove" until the writes are actually completed in Windows and the drive reports that the command to flush its internal buffers to the media has finished.

Related Question