3

Umount: Force – Target | Device is Busy

 2 years ago
source link: https://www.shellhacks.com/umount-force-target-device-is-busy/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Umount: Force – Target | Device is Busy

An 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 command:

$ 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>
Option Description
-f, --force Force an unmount.
-l, --lazy Lazy unmount (after the disk operations are done).

Cool Tip: How to mount an ISO image in Linux! Read more →


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK