"What had happened? When applications want to overwrite an
existing file with new or changed data (for example, a
configuration file after the user has changed a setting) frequently
they first create a temporary file for the new data and then rename
it with the system call - rename(). The logic behind this is that,
if something goes wrong during the write process, say the computer
crashes or there's a power failure, at least the old version of the
file will be retained.
"The process involves two things. First, metadata in the file
system is changed. An inode is created for the new file that
references the data, and a new index entry is generated that points
to the new inode. After a rename(), the index entry of the old file
is changed so that it points to the new inode. Second, the data
itself is written. To do this, the filing system must first
allocate a sufficient number of data blocks on the disk and then
write the data to those blocks."
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.