umount command is used to unmount a device/partition by specifying the path to the directory where it has been mounted.
Sometimes, when you run the
umount command you may receive the “target is busy” or “device is busy” errors indicating that there is some process that is using the mounted filesystem or the remote file server is not responding for some reason.
Luckily, it is possible to run the
umount command forcefully and this short note shows how to do this safely.
Cool Tip: Have added a new drive to
/etc/fstab? No need to reboot! Mount it with one command! Read more →
Force Umount if Target | Device is Busy
If you try to unmount a filesystem using the
umount command you may get an error like one of the errors below:
$ umount <path> - sample output - umount: <path>: target is busy. umount.nfs: <path>: device is busy.
This usually happens when the resource is used by another process.
To identify the process that locks the filesystem and prevents it from being unmounted you can use the
$ lsof | grep '<path>' - sample output - bash 2629 user cwd DIR 0,56 4096 6439010 <path> bash 2803 user cwd DIR 0,56 4096 6439010 <path>
Once identified you can
kill the process and try to
umount the filesystem one more time.
Alternatively you can force the unmount by running the
umount command with the following options:
$ umount -f -l <path>
||Force an unmount.|
||Lazy unmount (after the disk operations are done).|
Cool Tip: How to mount an ISO image in Linux! Read more →