Tag Archives: umount nfs not mounted

How to unmount NFS when the server is offline

Learn how to unmount NFS when the server is gone. Dead NFS mounts can be un-mounted using forceful and lazy umount command.

Unmount NFS share when server is gone

This article will help you to un-mount NFS share from the client when the NFS server is gone or offline or un-available or decommissioned. We have seen how to configure the NFS server and how to handle NFS stale file error. But what if your NFS server is gone and its shares are still mounted on clients. Normally, before shutting down the NFS server, all clients should be notified and advised to unmount NFS shares they are using from this server.

But, in case if any of the clients have still NFS mounted when the server goes down, then the client should forcefully un-mount it. Normal mount operation won’t be effective in such cases. When the NFS server is down, you observe below things on the client who has NFS share still mounted.

  1. df command hangs since it tries to fetch NFS information but the NFS server is not responding.
  2. Tools, utilities who use/check mount point information like Ignite backup shows below error.
    NFS server xyz not responding still trying
  3. fuser command hangs when running for the NFS mount point.
  4. umount (normal) command fails with the below error.
    root@kerneltalks # umount /data nfs umount: nfs_unmount: /data: is busy umount: return error 1. 

In this case, you need to use forceful (-f switch) and lazy umount (-l switch) to un-mount this dead NFS mount point. Lazy un-mount detach the said mount point from file system tree and cleans its all references once it’s not busy anymore.

Lazy un-mount is available in most Linux distributions. If not, you should be fine with only forceful un-mount too. In HPUX lazy un-mount is not available.

root@kerneltalks # umount -f -l /data

Conclusion

You can identify dead NFS share by df, fuser commands that appear to hang, failing to umount command. Such a dead NFS mount point can be un-mounted using forceful and lazy umount command.