3 ms·
“A write should either happen entirely or not at all.” I think many modern file systems try really hard to make that true, but I don’t think you can count on i
by Someone 6y ago
“A write should either happen entirely or not at all.”
I think many modern file systems try really hard to make that true, but I don’t think you can count on it. “man write” (https://man7.org/linux/man-pages/man2/write.2.html https://man7.org/linux/man-pages/man2/write.2.html) still says:
“Note that a successful write() may transfer fewer than count bytes”
It also says
“A successful return from write() does not make any guarantee that data has been committed to disk. On some filesystems, including NFS, it does not even guarantee that space has successfully been reserved for the data”
That should be handled by calling fsync, but of course, if that fails, there’s not a lot you can do (even if you exactly know what happened) (https://research.cs.wisc.edu/adsl/Publications/atc20-cuttlefs.pdf https://research.cs.wisc.edu/adsl/Publications/atc20-cuttlef...)
I also don’t think calling data loss due to writes that do not make it to disk “file system corruption” is correct. For file system corruption, the file system data structures have to be overwritten (e.g. the boot record or directory data structures)