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 "busy" filesystem, 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:
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 do that by using the below command:
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.