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.

On the server node, it is possible to access an exported folder. However, after reboots (both server and client), the folder is no longer accessible from the clients.

On server

# ls /data
Folder1
Forlder2

and the /etc/exports file contains

/data 192.168.1.0/24(rw,no_subtree_check,async,no_root_squash)

On client

# ls /data
ls: cannot access /data: Stale NFS file handle

I have to say that there were no problem with the shared folder from client side however after reboots (server and client), I see this message.

Any way to fix that?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The order of reboots is important. Rebooting the server after the clients can result in this situation. The stale NFS handle indicates that the client has a file open, but the server no longer recognizes the file handle. In some cases, NFS will cleanuo its data structures after a timeout. In other cases, you will need to clean the NFS data structures yourself and restart NFS afterwards. Where these structures are located are somewhat O/S dependent.

Try restarting NFS first on the server and then on the clients. This may clear the file handles.

Rebooting NFS servers with files opened from other servers is not recommended. This is especially problematic if the open file has been deleted on the server. The server may keep the file open until it is rebooted, but the reboot will remove the in-memory file handle on the server side. Then the client will no longer be able to open the file.

Determining which mounts have been used from the server is difficult and unreliable. The showmount -a option may show some active mounts, but may not report all of them. Locked files are easier to identify, but require the locking to be enabled and relies on the client software to lock the files.

You can use lsof on the clients to identify the processes which have files open on the mounts.

I use the hard and intr mount options on my NFS mounts. The hard option causes IO to be retried indefinitely. The intr option allows processes to be killed if they are waiting on NFS IO to complete.

share|improve this answer
    
Using hard, intr is good advice. However, note that NFS doubles the timeouts with each try. So you best set timeo=1 and retrans=5 or so. Note that this will put heavy strain on your NFS server after NFS restart. Try to not restart your NFS service so often ;) –  bjanssen Aug 4 at 12:27
    
Your answer is correct. I also found another simple solution. On the node that says stale NFS handler, just umount and remount the folder again. –  mahmood Aug 4 at 15:35

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.