Two questions here:
(1) What's the proper way to do an atomic replacement of a file
which survives a power failure?
Doing the following:
rename (new,old) worked O.K
The file old was replaced successfully by new.but
several hours later after a power failure 'old' was
corrupted. I can duplicate this situation at will
by switching the machine off.
Even unlink(new), link(old,new); unlink(new) doesn't work.
To get around the problem I've called sync() but this is very heavy
(2) My second question is - Is there something wrong with the
sync process under 2.5? Why are changes to file systems
uncommitted hours after the event?