Linux 101 : Troubleshooting - umount - device is busy -

A filesystem that is busy, can't be unmounted. This could happen if a process is running or a file is open on the filesystem we want to unmount.

When we try to unmout the "busyfilesystem, we receive the below error:

To investigate a little further, we could use the command "lsof" to displays the "busy" filesystem's open files, along with the programs that are using them.

For our filesystem that is mounted on the "/mnt" mountpoint, we could use the below command:

We could also use the "fuser" command as below:

The above command displays the values "2824203", "2827470", "2827479", which are the PIDs of the processes using the "busy"   filesystem.

The "c" indicates that the "/mnt" filesystem, is the current directory of the above processes.

We could also use the "-v" parameter to also display the username as below:

We could send a "kill" signal to end the processes that are keeping our filesystem "busy".

We could do that by using the below command:

Then, we could unmount our filesystem using the below command:

Using the "kill" signal could be a bit abrupt.
We could send a signal to a process to tell it to exit, when the work it is doing at the time of the receipt of the signal is done, including the release of resources.

We could use the "15" signal to gracefully shutdown the processes that are using our filesystem:

- 15: SIGTERM signal.


Leave as a comment: