Unix/Linux Go Back    

Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here.

Removing ".nfs" files

Filesystems, Disks and Memory

Thread Tools Search this Thread Display Modes
Old Unix and Linux 04-14-2002   -   Original Discussion by Jayathirtha
Jayathirtha's Unix or Linux Image
Jayathirtha Jayathirtha is offline
Registered User
Join Date: Aug 2001
Last Activity: 9 December 2003, 9:24 AM EST
Location: Bangalore
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux Question Removing ".nfs" files


I have a critical client-server application. I try to import a file from the local machine on to the server and open it (on the server). I can open it, but after this, when i try to open some other file on the server itself without saving this imported file, a .nfs file is being created.
This .nfs file will not be removed untill i close my application, but i am not supposed to close. Earlier i didn't have this problem. Now suddenly it started coming.

If anyone has come across anything like this, please help me in getting this sorted out.

I searched the web also, but nobody listed any solution nor the cause of this.

Sponsored Links
Old Unix and Linux 04-15-2002   -   Original Discussion by Jayathirtha
Perderabo's Unix or Linux Image
Perderabo Perderabo is offline Forum Advisor  
Unix Daemon (Administrator Emeritus)
Join Date: Aug 2001
Last Activity: 26 February 2016, 12:31 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 471 Times in 271 Posts
In unix, it is ok to create a file, then unlink it, and continue to read and write to it. When you remove the last link to a file, it becomes a file with zero names. But the inode will not be freed until all processes close it. This is often done with temporary files. If the process aborts, the file will go with it.

It is hard to implement this in an nfs environment. If a nfs client gets a request from a local process to delete a file, it checks to see if any local processes still have that file open, if so, it renames the file to a .nfs<something> file. And after the last local process closes the file, the nfs client will actually issue the delete.

If you are running a process on a nfs client and that process attempts a unlink() system call on a open file, the above scenario plays out. But the process still has the file open. You should be glad that .nfs file is still around. You must be holding the file open in order to eventually do i/o to it. If this is not the case, the process has a bug. It should close the file if the file is no longer needed. If the process is going to run for days or weeks and it is opening files that it will never close, the file table will eventually fill.

The .nfs files should not really cause any trouble unless they are very large. Some people run a cron job on the nfs server that finds .nfs files that have not been accessed in the past two weeks and deletes them.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 09:59 AM
"Join" or "Merge" more than 2 files into single output based on common key (column) Katabatic Shell Programming and Scripting 1 05-20-2010 12:41 PM
Removing "Failed none for" error messages from sshd logs files Mr_Webster Solaris 3 04-21-2010 12:18 PM
Delete files older than "x" if directory size is greater than "y" JamesCarter Shell Programming and Scripting 4 02-11-2010 08:41 AM

All times are GMT -4. The time now is 06:45 PM.