Originally posted by Santana Iyer:
I am more worried about corruption of data rather than performance.
If you write a new file, while saving the old one, and only rename the new one once you know that the file writing went OK, as you've described, then this is generally a safe thing to do. Of course, you do have to worry about concurrent updates, something you haven't mentioned here. If there is more than one user of the system at a time, then rewriting a single file obviously becomes a difficult and dangerous thing to manage.