title: Disk access during file copy and rename in ext4
body: <p>I have a process let's say 'A' whose job is to copy three 4 GB files to a temporary file and then rename it by overwriting to an existing file. 'A' does this every 15 minutes. The CentOS version is 2.6.32-504.23.4</p>
  
  <pre><code>boost::filesystem::copy_file()
  rename()
  </code></pre>
  
  <p>Now I am certain that the copy_file() takes only 5 seconds because I have the code to print timestamps. However what appears is that the overall operation together with rename() takes more than 3 minutes. </p>
  
  <p>So my question is, at which point is the content of the file written to the disk from memory? I have not observed the copied file to have a zero size anytime. The ext4 mount is with default options. I also do not have any other calls like fsync() in between.</p>