When interacting with block devices that have been mounted on the file system, the IO is buffered so reads and writes may not actually reach out to the backing hardware until some time in the future. I believe the same is also true for block devices that have been mmap'd as they map now exists in the filesystem (?) but as soon as the map & device are closed the buffer is emptied as it stops existing in the filesystem.
What about when accessing a block device without mounting it or mmaping it? I have a SPI memory block device and I use the dd
command to write some data to it, and then a while later I will use the dd
command to read that data back. Is any of that data buffered or is it all being written and read from the device directly?
I believe it's not buffered because when I perform a tiny write the operation hangs for a moment, if it was buffered I'd expect it to be instant since it doesn't have to communicate with the device, but I can't find any concrete info on if that's true or not.