Learn how to unmount NFS when server is gone. Dead NFS mounts can be un-mounted using forceful and lazy umount command.
This article will help you to un-mount NFS share from client when NFS server is gone or offline or un-available or decommissioned. We have seen how to configure 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 NFS server, its all clients should be notified and advised to unmount NFS shares they are using from this server.
But, in case if any of the client has still NFS mounted when server goes down, then client should forcefully un-mount it. Normal mount operation wont be effective in such cases. When NFS server is down, you observe below things on client who has NFS share still mounted.
- df command hangs since it tries to fetch NFS information but NFS server is not responding.
- Tools, utilities who uses/checks mount point information like Ignite backup shows below error.Shell123NFS server xyz not responding still trying
- fuser command hangs when run for NFS mount point.
- umount (normal) command fails with below error.Shell12345root@kerneltalks # umount /datanfs umount: nfs_unmount: /data: is busyumount: 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 its not busy anymore.
Lazy un-mount is available in most Linux distributions. If not, your should be fine with only forceful un-mount too. In HPUX lazy un-mount is not available.
root@kerneltalks # umount -f -l /data
You can identify dead NFS share by hanging df, fuser commands, failing umount command. Such dead NFS mount point can be un-mounted using forceful and lazy umount command.