On Sunday, 14 March 2021 16:31, Joseph Mayer <[email protected]> wrote: > Hi misc@! (Copying posters to the previous threads on this topic)
Pondering further: 5) "mount -o sync" is practically never useful, isn't it so?: mount's default synchronicity setting is that data is written asynchronously. But, fsync(int fd) "causes all modified data and attributes of fd to be moved to a permanent storage device" (http://man.openbsd.org/fsync.2), thereby serving as synchronous checkpoint for a file's writes to disk up to that moment, isn't it so. (And if like this doing fsync() at sync points, there is no relevance in calling sync() (http://man.openbsd.org/sync.2) on top of that, right.) Normal Unix software will not expect fwrite():s to hit disk in sequential order, but instead transactional mechanisms will use fsync() to ensure pending writes have been flushed to disk. (The underlying disk's actual propensity to actually flush itself, would be a separate question altogether and vary between SSD manufacturers.) Relative to mount's default setting, "mount -o sync" just enforces some form of stricter order of writes to disk than the default, and in practice software will not expect and thus not have value of such an order. Therefore, "mount -o sync" is normally not practically relevant neither on development nor on production machines? (Note http://man.openbsd.org/sync.2 says the in-kernel process runs sync() every 30 seconds, good to know. I presume this means sync() will write any not yet written *data* to disk where data is in asynchronous mode, while not yet written metadata will always? sometimes? *NOT* be written where metadata is in asynchronous mode.)

