NFS Issues

.1 nfs issues
NFS (.nfs files) causing problems with application
NAS Filer Mountpoints creating .nfsxxxx files while trying to remove Open Files

Cause of this problem
The NFS specification suggests that NFS clients not send REMOVE operations for a file that is currently open and in use by a process. Instead, clients should RENAME the file in the form .nfsxxxx. Only once the file is closed and no other process is accessing it will the NFS client issue the REMOVE operation.

In some circumstances the NFS client may never remove the .nfsxxxx file. This may occur when the process holding the file open does not exit or the client crashes while a .nfsxxxx file is in use.

Solution
Finding the NFS client and process using a .nfsxxxx file may be very time consuming. It would require checking every process on every NFS client that could be accessing the NFS share containing the file. A utility such as ‘lsof’ may be used to determine the process using the .nfsxxxx file. To prevent .nfsXXXX files from being created, do not remove a file when it is open. If the .nfsxxxx file is determined to no longer be in use then it may be removed. If a remove results in a new .nfsxxxx file then a process on that NFS client has the file open.
Demonstration for creating and removing .nfsxxxx files:
1. From the NFS client, create a file in the mounted NFS share and open it with the tail command. Suspend the process with ctrl-z or open a new terminal to complete the rest of the demonstration.

shell# echo test > foo
shell# tail -f foo
test
^Z
[1]+ Stopped tail -f foo

2. Remove the file ‘foo’ to make the NFS client create the .nfsxxxx file.

shell# rm foo
shell# ls -A
.nfs5ACF

3. Observe that subsequent rm commands only make the NFS client rename the file again.

shell# rm .nfs5ACF
shell# ls -A
.nfs6ACF

4. Locate the process that has the file open using lsof or fuser.

shell# lsof ./.nfs6ACF
COMMAND   PID USER   FD   TYPE DEVICE  SIZE NODE NAME
tail    25725 root    3r   REG    8,1 27603 6647 .nfs6ACF

shell# fuser .nfs6ACF
.nfs6ACF 25725o
5. Finally, kill the process holding the file open and observe that the .nfsxxx file is now removed.

shell# kill 25725

shell# ls –al
total x
drwxr-sr-x  2 root src    400 Mar 29 15:39 .
drwxrwsr-x 36 root src   3336 Mar 21 09:37 ..

Solaris Reference : http://www.sunmanagers.org/archives/1998/0229.html