On Mon, 2024-01-22 at 18:26 +0300, Ilia Zykov wrote: > > > > More over. There is a very old post about fsync() lying. > https://brad.livejournal.com/2116715.html > I don’t know, maybe this is also a post-lie) Or now the devices have > become more truthful. > But many devices report that "Write cache" is enabled: > > hdparm -I /dev/sda | grep 'Write cache' > * Write cache > > And in many cases fsync() flushes data to write cache only. > But this can be persistent (ssd, flash) cache. Or as Zdenek has > wrote, > "devices 'should' have enough energy held internally to be able to > flush > out all the caches in in emergency cases". > > However, in some cases, they may lose some data due to power failure > and > large amount of dirty data in the cache, especially ordinary, > non-enterprise HDD. IMHO. SCSI has had SYNCHRONIZE_CACHE and FUA at least since SCSI-2 in the mid-90s. It's true that some devices lie about the actual behavior, because bypassing the cache is bad for benchmark results, and many end users care more about performance than data safety, but that's not LVMs (or even the kernel's) business. As Su wrote already, the kernel has to trust the hardware. Martin