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

Does NFS allow me to unlink/delete open files like I can do with local file systems?

The reason I ask is that I'm developing something that runs on multiple servers and may access NFS as a back end. It simplifies things somewhat if I can do an unlink on a file that is open.

This is a nice feature of the linux (unix?) filesystems that you can unlink a file that is open. It simply removes the directory entry. The file is still available to a process that holds it open as long as it is open. Once closed the inode is destroyed.

Does that same functionality hold true for files opened on NFS mounts?

share|improve this question
    
You may wish to rephrase (to prevent votes down), at first glance it looks like you are asking if you can delete files using NFS, which had me quite perplexed about why you would be asking such a basic question with the number of points you have. :-) –  Red Tux May 9 '11 at 5:17

1 Answer 1

up vote 4 down vote accepted

The short answer is yes.

Since NFSv3 is stateless, the NFS client driver accomplishes this with something called "silly rename", where the deleted file is renamed to something like .nfsXXXXXXXXXX. This generally works, but there are a few caveats compared to a local filesystem. For instance, if the client crashes then those .nfsXXXX files will not be deleted, and you'll have to clean them up manually.

I think as of NFSv4.1 the protocol has the required features to implement delete-on-last-close without silly rename, but I don't know if any clients/server yet implement this.

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.