Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Will the other process be able to finish reading the old file even though it's been replaced?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

If the other process keeps the file open the entire time, then yes it should be able to continue reading.

Just like you can delete an open file, and processes that file open will still be able to read/write from the file, until it closes.

share|improve this answer
    
And it's not filesystem dependent right? –  user533020 Mar 9 '12 at 22:42
    
@user533020: It's certainly this way on all *NIX FS: ext, xfs, jfs, etc. FAT and NTFS (especially the userspace implementation) may behave differently. –  Hubert Kario Mar 9 '12 at 23:56

Yes, the process with the file open will be reading the file via an open file descriptor. The mv command just changes the associated directory entry.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.