How do I fix NFS stale handle?

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.

What is stale NFS file handle in Linux?

A filehandle becomes stale whenever the file or directory referenced by the handle is removed by another host, while your client still holds an active reference to the object. So this can occur if the directory is modified on the NFS server, but the directories modification time is not updated.

Where can I find stale NFS mounts?

Stale files are usually found using ls -ltR / | grep “\?” , but this usually takes some time (since it goes over all files in a given path). To further clarify, the issue seen in specific files such as Java library file(s) rather than the whole mount.

What causes stale NFS mounts?

What causes an NFS “stale file handle” error? The answer is any change in the mounted file’s underlying inode, disk device, or inode generation on the NFS server causes an NFS stale filehandle.

What is a stale file?

A file handle becomes stale when the file or directory referenced by the handle is removed by another host/server, while our client still holds an active reference to the object file/directory.

Why is NFS bad?

One of the shortcomings of NFSv2 was its lack of cache consistency. NFS makes no guaran- tees that all clients looking at a file or directory see exactly the same content at any given mo- ment. Instead, each client sees a snapshot of a file’s state from a hopefully not too distant past.

How restart NFS service in Linux?

Redhat / RHEL / CentOS Linux: Start / Stop / Restart NFS Service…

  1. Start / Stop / Restart portmap Service under RHEL. Type the following commands:
  2. Start / Stop / Restart NFS Service under RHEL / CentOS Linux. Type the following commands:
  3. Automatically Start the NFS Server.

What is var lib NFS ETAB?

An NFS server maintains a table of local physical file systems that are accessible to NFS clients. The master export table is kept in a file named /var/lib/nfs/etab. This file is read by rpc. mountd when a client sends an NFS MOUNT request.

How do I export a FS?

Examples

  1. To export all directories in the /etc/exports file, enter:
  2. To export one directory from the /etc/exports file, enter:
  3. To unexport a directory, enter:
  4. To display the name of the directory currently being exported, enter:
  5. To export a directory that is not specified in the /etc/exports file, enter:

What does stale NFS handle Mean after reboot?

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 cleanup its data structures after a timeout.

How to resolve mount.nfs error handle error?

Try killing them off to free mount point. Once done you will be able to un-mount it properly. Sometimes it still gives the same error for mount command. Then try mounting after restarting NFS service at the client using the below command. Even if this didn’t solve your issue, final step is to restart services at the NFS server.

What does a filehandle mean in NFS server?

Again, filehandles are essentially meaningless to the client that is mounting an NFS share. Even if the client could decode the filehandle, the client doesn’t have direct access to the file system or disks on the NFS server and therefore that filehandle with its inode, disk, and inode generation data mean nothing to it.

Is there a cure for stale file handle errors?

When it comes to NFS stale file handle errors, an “ounce of prevention is worth a pound of cure”. It’s always best to understand how your NFS shares are being used, but that’s another topic for another time. Besides, unfortunately, these errors can’t always be prevented.