Skip to main content
Troubleshooting

Fixing 'Umount Target is Busy' Error in Linux

A not-so-uncommon error while using umount command is 'target is busy'. Learn what you can do to get rid of this error.

Sagar Sharma

Warp Terminal

Unmounting disks in the Linux command line is not complicated. All you have to do is to use the umount command:

umount target

But once in a while, you'll come across an error that says 'umount: target is busy':

target is busy while unmounting the drive in Linux

So how are you supposed to solve this issue?

Well, before solving this issue, let me share the reason behind this problem first.

The reason behind Umount target is busy

The reason is quite simple! The target device is still in use.

With enough permissions, any process might be utilizing that drive that you want to unmount, and to prevent data loss, the kernel won't allow you to unmount.

How to solve Umount target is busy in Linux

⚠️
If an ongoing data transfer occurs in the background, you may lose your data by forcefully unmounting your drive.

There are times when you want to unmount the drive at any cost. Perhaps the drive isn't responding for some reason and you want to unmount it.

In this tutorial, I will share three ways to unmount the target:

  • By killing the process itself
  • Using force unmount
  • Using the lazy unmount

Let's start with the first method.

This is the best way of unmounting the target in my opinion as you are eventually killing the process itself.

The first step is to find the PID of the process that causes the problems.

To do so, I will be using the lsof command in the following manner:

sudo lsof /Path/to/target
find PID of the mounted drive

Once you get the PID, it's quite simple to force kill the process:

sudo kill -9 [PID]

And now, you should be able to unmount the drive easily:

kill the process and unmount the drive

Pretty neat way. Isn't it?

Method 2: Using force unmount (for Network File Systems)

The force unmount option is mainly preferred by those who are dealing with network file systems.

So it may NOT give you the expected results with your local file system.

To use the force unmount, you will have to use the same old umount command but with the -f flag:

sudo umount -f /Path/to/target
use force unmount to solve target is busy error

Method 3: Using the lazy unmount (Schrödinger's unmount)

📄
This option does not actually unmount your target but just removes the target from the namespace. And will unmount the target when the drive is not being utilized anymore!

It is more of a Schrödinger's mount when you can never be sure of whether the filesystem is unmounted or not!

So why am I even adding this to the solution's list? Well, this is the least harmful way of unmounting your stubborn drive.

To use the lazy unmount, you will have to use the -l flag with the umount command as shown:

sudo umount -l /Path/to/target
using the lazy unmount to solve the target is busy in linux

And here you have it!

Which one should you choose?

In times like you have to have your drive unmounted, I would prefer going with the 1st method which involves killing the process itself.

And there is a strong reason why. It gets my job done without any hiccups.

Sure, you may want to go with either of the last two options based on your use case.

Sagar Sharma