Don’t fear the fsync! | Thoughts by Ted
A successful close does not guarantee that the data has been successfully saved to disk, as the kernel defers writes. It is not common for a file system to flush the buffers when the stream is closed. If you need to be sure that the data is physically stored use fsync(2).
Posted March 17, 2009 at 1:15pm