Block devices provide buffering. This means that
write() on a block device can return success, before the kernel has written the data to the device. A program can wait for all the buffered writes by calling
I have used
cat) to write a filesystem image to a device. These commands do not call
fsync() by default.
Next, suppose that I want to
mount the written block device as a filesystem.
I suppose it is safest to e.g. use the
sync command before mounting it. But what if I do not sync the block device? Is it possible that the filesystem might try to read some blocks, which have not yet been written to the device? Then could it read the old contents of the device, and not the correct data from the filesystem image?
My primary interest is in Linux behaviour. (And StackExchange encourages me to ask one specific question. I can upvote any alternative or historical behaviour as well though :-).