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
boost::filesystem::copy_file()
rename()
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.
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.