4 ms·
Contrary to popular belief, even consumer drives will honor flush commands. The problem is operating systems generally do not send flush commands, even when you
by magila 7y ago
Contrary to popular belief, even consumer drives will honor flush commands. The problem is operating systems generally do not send flush commands, even when you might expect it (e.g. last I checked fsync() on Linux does not send a flush).
Disabling write caching resolves these problems. Unfortunately SATA drives typically ship with write caching enabled by default.
- zaarn 7y agoSome cheaper HDDs and third-rate drives won't honor flushes. Same for SSDs, a few very cheap ones ignore flushes in favor of cache performance.
- networkimprov 7y agoReferences?
- aidos 7y agoNot quite the same thing but it turns out there are some other gotchas with fsync on Linux https://lwn.net/Articles/752063/ https://lwn.net/Articles/752063/
- tobias3 7y agoOf course fsync() sends a flush to the disk (unless you use non-standard mount options or "eatmydata"). They may not honor the FUA bit, though, but hopefully nobody relies on this if they expect it to work with consumer disks (See e.g. here https://devblogs.microsoft.com/oldnewthing/20170510-00/?p=95505 https://devblogs.microsoft.com/oldnewthing/20170510-00/?p=95... ). What I have heard is that some disks have problems if they are on a error recovery path. E.g. they have a corrupt sector or a sector that needs reallocation (pending sector), and then they have a power failure while the sector is reallocated.
- tinus_hn 7y agoThe implementation of fsync is FS dependent. On the default ext4 filesystem with the default options (barrier) fsync does send flush.