Issue

You need to unmount a volume, but after using your command to umount it, you get this error:

root@myserver:~ # umount /var/www/shared/
umount.nfs: /var/www/shared: device is busy

No need to use the –force option, you must find the root cause.

Solution

This means that a process listens where you want to perform your action, you have to identify it and see to kill it.

To do this, use the lsof command which allows you to have the list of processes listening on the desired tree

COMMAND     PID               USER   FD   TYPE DEVICE SIZE/OFF       NODE NAME
bash      27361               deploy_user  cwd    DIR   0,42     4096 4106770793 /var/www/shared/scripts (192.168.10.5:/var/www/shared)

To unblock the situation, just stop the service / kill the process.

In our case, it is a specific user located in the directory we want to unmount

kill 27361

Now I can umount my directory.