How to ensure all data has been physically written to disk?

后端 未结 7 1212
执念已碎
执念已碎 2020-11-27 05:44

I understand that .NET FileStream\'s Flush method only writes the current buffer to disk, but dependent on Windows\' disk driver and the hard disk firmware this is no guaran

7条回答
  •  旧时难觅i
    2020-11-27 06:05

    The file data that's buffered in the file system cache to be written to disk. That data is normally lazily written, based on the position of the disk write head. Having a gigabyte of cached data is technically possible so it can take quite a while. If this is important to you then consider the FileOptions.WriteThrough option instead.

提交回复
热议问题