How To Fix “umount target is busy” in Linux

How to Fix umount target is busy in Linux

Some of the error on Linux is annoying and the “umount target is busy” error is one of the them. It normally occurs while you try to umount a filesystem or drive in Linux. It happens when you are trying to mount a device or filesystem that is being used by the some process in Linux. It occurs to prevent data loss in Linux.  In this tutorial, we will gudie you through the process to fix umount target is busy in Linux.

How to Fix umount target is busy in Linux

There are multiple ways to to fix umount target is busy error in Linux.

1. Using fuser –  Kill processes accessing the file

In this method, we will take the help of fuser command. It normally identify the processes which are accessing sockets or files on filesystems. Run the following command with -m option to list down the all processes that is accessing the files or mount point on the file system in a tabular format.

fuser -mv /media/dsk

After figuring out the processes that is using the file on the mounted filesystem, You can use the following kill command to delete or terminate those processes.

fuser -kmv /media/dsk

2. Using lsof – Find and Kill the processes using the file

In this method, we will use  lsof  command to display the all open files and the processes associated with them and kill them afterward. Run the following command to find PID (process id) corresponding to the mount point.

lsof /media/dsk or lsof  | grep '/media/dsk'

Now, Run the kill process to terminate the particular process:

kill -9 3522
kill -9 4001

3. Lazy unmount

Lazy unmounting command removes all references to the detached file system when the process holding or occupying particular filesystem or the mount is no longer using it or holding it. Once no processes are accessing the unmounted file system, the umount command executes and actually detaches the file system. To lazy unmount run the command with  -l option followed by the mount path:

umount -l

4. Force unmount to Fix “umount target is busy” in Linux

You can use this option if you are trying to unmount an NFS filesystem in Linux. Force unmount will detach the server mount point by terminating the running processes.

unmount -f /path/to/busy-nfs-mount

Leave a Comment