Target is busy. How to fix unmountable device

Target is busy. How to fix unmountable device

It sometimes happens that a device can not be unmounted.

When mounting from nautilus, "Volume is busy" titled dialog appears with following content: "One or more applications are keeping the volume busy".

If trying with the umount command, the command exits with error: "umount: /media/transang/SangWDPP: target is busy.".

How to figure out reason and fix?

Assume that the path of the directory being mounted is /media/transang/SangWDPP. lsof can be used to find out which process is keeping the device busy

# sudo lsof | grep /media/transang/SangWDPP
zsh       48966                            transang  cwd       DIR               8,49      131072          1 /media/transang/SangWDPP

Now, we know that there is a zsh terminal which may cding at the being mounted directory. After the terminal is closed, the device is now able to be unmounted via either the umount command or nautilus icon.