Learn, Solve & Master Python, Linux, SQL, ML & DevOps
Fix “Device Is Busy” Error When Unmounting a Filesystem in Linux
Problem Overview
While attempting to unmount a filesystem using the
umountcommand, Linux may return the following error:umount: /mount/point: device is busy
This happens when one or more processes are actively using the mounted filesystem. The system prevents unmounting to avoid data corruption or unexpected application failures.
This issue is commonly encountered during:
disk maintenance
filesystem checks
storage migration
system cleanup
server shutdown or reboot preparation
Prerequisites
Before starting, make sure the following conditions are met:
- Root or sudo privileges
- Basic understanding of Linux filesystems
lsofandfuserutilities installed (usually available by default)- The mount point you are trying to unmount
Solution
- Identify and confirm the exact mount point
[root@pythonlinuxhub /]# umount /data umount: /data: target is busy.[root@pythonlinuxhub /]# mount | grep /data /dev/mapper/rhel_10-data on /data type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
Use lsof command and find the processes using the filesystem
[root@pythonlinuxhub /]# lsof +D /data COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ping 3015 root 1w REG 253,3 22 131 /data/ping_result ping 3015 root 2w REG 253,3 22 131 /data/ping_result ping 3025 root cwd DIR 253,3 25 128 /data ping 3025 root 1w REG 253,3 22 131 /data/ping_result ping 3025 root 2w REG 253,3 22 131 /data/ping_result[root@pythonlinuxhub /]# lsof | grep /data ping 3015 root 1w REG 253,3 22 131 /data/ping_result ping 3015 root 2w REG 253,3 22 131 /data/ping_result ping 3025 root cwd DIR 253,3 25 128 /data ping 3025 root 1w REG 253,3 22 131 /data/ping_result ping 3025 root 2w REG 253,3 22 131 /data/ping_resultNote the PID and process name.
- Use fuser command and find the processes using the filesystem
[root@pythonlinuxhub /]# fuser -vm /data USER PID ACCESS COMMAND /data: root kernel mount /data root 3015 F.... ping root 3025 F.c.. ping
- Gracefully stop or kill the blocking process
[root@pythonlinuxhub /]# kill 3015 [root@pythonlinuxhub /]# lsof | grep /data ping 3025 root cwd DIR 253,3 25 128 /data ping 3025 root 1w REG 253,3 22 131 /data/ping_result ping 3025 root 2w REG 253,3 22 131 /data/ping_result [1]- Terminated nohup ping google.com >> /data/ping_result 2>&1 (wd: ~) (wd now: /) [root@pythonlinuxhub /]# kill -9 3025 [2]+ Killed ping google.com >> /data/ping_result 2>&1 (wd: /data) (wd now: /) [root@pythonlinuxhub /]# lsof +D /data
- Unmount the filesystem
[root@pythonlinuxhub /]# umount /data
- To unmount NFS or unreachable remote mounts
[root@pythonlinuxhub /]# umount -f /mount-point
Ensure the filesystem is unmounted
[root@pythonlinuxhub /]# mount | grep /data
To make the unmount permanent, comment or delete the filesystem entry in
/etc/fstabso it won’t be mounted after reboot.
Note:
Always identify processes before forcing unmount
Avoid
kill -9unless necessaryNever force-unmount critical system paths
For production servers, notify users before unmounting shared storage
Shaik Mohammed Faruk
Software Engineer sharing practical tutorials and insights on Linux, Python, SQL, and modern technologies.
Read more About Me
