Quick Contact

Contact our team on
01788 298450
Or use our callback by entering your number here for an instant response
Resolving Stale nfs file handle issues on Linux
Articles & Information - Tech Talk

NFS is a mature and simple system for file sharing across systems. It is not the fastest or most feature rich but is supported by almost everything so is an easy choice for *nix users.

When your NFS server is restarted, it is common for existing clients to report a "Stale NFS file handle" when accessing shared resources. This is a server issue, not a client issue as one may assume.

To resolve this, there are 2 options:

1) Refresh the server (Recommended)

The server needs to have a new registry of connected clients in the local exports table. To achieve this, just run the following command:

exportfs -f

This is described in the manual page as:

"In 'new' mode, flush everything out of the kernels export table. Any clients that are active will get new entries added by mountd when they make their next request." 

2) Remount the client mount

Remounting the share can be achieved as follows:

mount -o remount /home

The client may not let you do this if there are processes using the share. You will see an error like this:

umount.nfs: /home: device is busy
If this is the case, use fuser to see what is using the share like this: 

fuser -fvm /home/

The response may be similar to this: 

root@vm-1207:/etc/exim4/conf.d# fuser -fvm /home/
                     USER        PID ACCESS COMMAND
/home/:              root     kernel mount /home
                     root       1884 ..c.. tail
                     macky     16764 F.c.. imap
                     macky     22163 ..c.. bash
                     macky     27809 ..c.. bash

You can then close off the programs accessing the share and remount.

 

 
 
Open Source Software Companies - UK
Opus Vision Limited T/A OpusVL Registered UK number 3905104
We are featured in the FreeIndex Software Development directory