How To Unmount NFS Mount When Server is Not Responding

Overview:

This guide shows how to forcefully unmount an NFS mount when the NFS server is not responding or is unreachable.

Problem

I tried to check my one of my NFS client server disk space usage using the “df -h” command but the command was not responsive. After checking the /var/logs/messages and /var/logs/messages log files, I discovered that the kernel was complaining about the NFS server not responding. I saw the error “kernel: [11020966.208697] nfs: server x.x.x.x not responding, timed out” in the logs as shown in the following screenshots.

#tail -f /var/logs/messages
Tail /var/www/messages log file to check the latest error logs
#tail -f /var/logs/messages
Tail /var/www/syslog file to check the latest error logs
Solution

In such a scenario, you simply need to unmount the NFS mount on all the NFS clients using the unmount command as follows. Remember to replace /path/to/nfs_mount with the path to your NFS mount on the client-server.

#umount /path/to/nfs_mount

After running the umount command, I noticed that it wasn’t responding. So I decided to force the unmount by adding the -f and -l flags to force the unmount and enable lazy unmount respectively. Note that the forced unmount requires kernel 2.1.116+. And -l flag tells umount to detach the filesystem from the file hierarchy now and clean up all references to this filesystem as soon as it is not busy anymore.

#umount -f -l /path/to/nfs_mount
Forcefully unmount an NFS mount when the NFS server is not responding

After using the above flags with the umount command, I was able to unmount the NFS mount, and any commands to check disk usage started running smoothly again.

For more information, read the umount man page, it has several other useful options:

#man umount
Conclusion

Hopefully, this guide helped you to address the above error or put an end to hanging commands. If you have any questions or comments, use the feedback form below to post them.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Page Contents