Operations 8 min read

How to Force Unmount Busy NFS Mounts on Linux Using lsof, fuser, and Kill

This guide explains why NFS mounts can appear busy, how to identify the blocking processes with lsof and fuser, and step‑by‑step commands to safely kill those processes or perform a lazy unmount, ensuring the filesystem is cleanly detached.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Force Unmount Busy NFS Mounts on Linux Using lsof, fuser, and Kill

Why NFS Unmount May Fail

When you try to unmount an NFS share, the kernel can report device is busy. In such cases you must force the unmount after stopping the processes that are still using the mount point.

Setup

A mount point /var/linoxide was created. Attempting to unmount the remote partition results in an error.

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   3G   18G   7% /
devtmpfs        236M     0  236M   0% /dev
tmpfs           245M     0  245M   0% /dev/shm
tmpfs           245M     4M  237M   4% /run
tmpfs           245M     0  245M   0% /sys/fs/cgroup
1241:/var/linoxide 20G   3G   18G   7% /mnt/nfs/linoxide_srv
1241:/home      20G   3G   18G   7% /mnt/nfs/home_srv
# umount /mnt/nfs/linoxide_srv/
umount.nfs4: /mnt/nfs/linoxide_srv: device is busy

Using lsof

The lsof command lists open files and the processes that hold them. Filtering by the mount point shows which PIDs are still using it.

# lsof /mnt/nfs/linoxide_srv/
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
bash      24098 root   cwd   DIR  253,1   4096 519062 /mnt/nfs/linoxide_srv
bash      24125 root   cwd   DIR  253,1   4096 519062 /mnt/nfs/linoxide_srv
vim       24144 linoxide cwd DIR  253,1   4096 519062 /mnt/nfs/linoxide_srv

Identify the PIDs (e.g., 24098, 24125) and terminate them with kill -9.

# kill -9 24098
# kill -9 24125

After killing, verify with lsof that only one process remains, then retry unmount.

# umount /mnt/nfs/linoxide_srv/
umount: /mnt/nfs/linoxide_srv/: not mounted

Using fuser

The fuser command can also show which processes are accessing a mount point. The -v flag provides detailed output, and -k can kill the processes.

# fuser -mv /mnt/nfs/linoxide_srv/
 USER   PID ACCESS COMMAND
/root   kernel mount /mnt/nfs/home_srv
root    24191 ..c.. bash
root    24275 ..c.. bash
linoxide 24290 ..c.. vim
# fuser -kmv /mnt/nfs/linoxide_srv/

After killing, the mount point is free and can be unmounted.

Lazy Unmount

If processes still hold the mount, you can request a lazy unmount with umount -l. The mount disappears from the namespace, and the actual unmount occurs when the last process releases it. # umount -l /mnt/nfs/linoxide_srv/ Check the exit status ( echo $?) and verify with df -h that the mount point is no longer listed.

Conclusion

Before forcing an NFS unmount, use lsof or fuser to locate and stop the processes that keep the filesystem busy. Killing those processes or using a lazy unmount ensures the NFS share is safely detached without leaving stale mounts.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

System AdministrationNFSlsofUnmountfuser
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.