How to durably rename a file in POSIX?
What's the correct way to durably rename a file in a POSIX file system? Specifically wondering about fsyncs on the directories . (If this depends on the OS/FS, I'm asking about Linux and ext3/ext4). Note : there are other questions on StackOverflow about durable renames, but AFAICT they don't address fsync-ing the directories (which is what matters to me - I'm not even modifying file data). I currently have (in Python): dstdirfd = open(dstdirpath, O_DIRECTORY|O_RDONLY) rename(srcdirpath + '/' + filename, dstdirpath + '/' + filename) fsync(dstdirfd) Specific questions : Does this also