How to ensure all processes are killed before unmounting a filesystem?
3
votes
1
answer
3696
views
I am trying to unmount a busy file system on which continuous I/O reads and writes are happening by a multithreaded program due to which the umount command fails.
root@ubuntu:~ # umount /mount/v1
umount: /mount/v1: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
Now, I tried to kill all the processes using
/sbin/fuser -m /mount/v1 -k
But as per fuser Command
> fuser -k or -K might not be able to detect and kill new processes that are created immediately after the program starts to run.
which is what happens in my case as some of the threads might have issued IO request when at the same time. When I again go for unmounting the file system, it again says it is busy and this becomes a loop.
My question is, how do I ensure that no new processes are able to do read/writes to the filesystem once
/sbin/fuser -m /mount/v1 -k
command is issued so that the filesystem can be gracefully unmounted.
Asked by Vikas Kumar
(31 rep)
Mar 8, 2020, 10:26 AM
Last activity: Jul 2, 2023, 07:07 AM
Last activity: Jul 2, 2023, 07:07 AM