On Fri 13 Sep 2024 at 15:00:14 (+0300), Anssi Saari wrote: > David Wright <deb...@lionunicorn.co.uk> writes: > > On Tue 10 Sep 2024 at 11:56:25 (+0300), Anssi Saari wrote: > > >> Why do you think that? Which part of the fsync manpage explicitly covers > >> fsync's effect on device files? Share share, it's fair. > > > “fsync() transfers ("flushes") all modified in-core data of (i.e., > > modified buffer cache pages for) the file referred to by the file > > descriptor fd to the disk device (or other permanent storage device) > > so that all changed information can be retrieved even after the > > system crashed or was rebooted. This includes writing through or > > flushing a disk cache if present. The call blocks until the device > > reports that the transfer has completed. It also flushes metadata > > information associated with the file (see stat(2)).” > > You just parroted a man page I had already read. Why did you think > that'd be helpful?
Um, because you asked me too, above. > I asked the questions because the man page didn't > answer my questions. As you are apparemntly unable I found for example > https://unix.stackexchange.com/questions/473854/block-device-cache-v-s-a-filesystem I see that I looked at that page back in May 2021 (the page has been updated since then), when the list had a previous conversation on dd, partly about blocksize, but in which we were told that we were only meant to be using dd with tapes or when converting, say, EBCDIC to ASCII, or whatever. I've yet to find another tool that can give you progress when already in progess. I had landed on a different page from the above this time around, https://stackoverflow.com/questions/58276098/fsync-with-raw-device-fd but I couldn't determine a definitive answer there. There still seems to be some disagreement in this thread. > and so arrived to the conclusion that the final close(2) call on a block > device already flushes all buffers before returning. So the answer to > the question "is running sync needed after dd to block device" is > no. Someone else posted that too on this list recently, in another > thread. Well, if you knew that already, you could have just posted your view rather than "Share share, it's fair". Of course, we all know that the time it takes to add ;sync to a command line is hardly going to delay you more than a suitably sized choice of blocksize, so much of this discussion is moot in practical terms. Cheers, David.