← Back to context

Comment by labawi

5 years ago

> As far as I see for the general case, being "very careful and really knowing what you're doing" consists of just avoiding direct overwrites.

That's a dangerous thing to say. There are many ways to mess up your data, without directly overwriting old data.

If you write a new file, close, then rename, on a typical linux filesystem, mounted with reasonable options, on compliant hardware, I think you should have either the old or new version of the file on power loss, even if you don't sync the proper things in proper order, but that's only because of special handling of the common pattern. See e.g. xfs 0 size file debacle.

Not an expert.