Umount target is busy что делать
Перейти к содержимому

Umount target is busy что делать

  • автор:

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.

Fixing ‘Umount Target is Busy’ Error in Linux

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.

Method 1: Unmout target by killing the process itself (recommended)

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.

Что делать при ошибке размонтирования в Linux

доступа к устройствам в Linux

Как исправить ошибку размонтирования в Linux?

Каждый знает, что прежде, чем вынуть флешку из USB-разъема, нужно выполнить команду (или нажать значок) размонтирования. Не всегда эта команда завершается успешно, и в ответ вы можете получить сообщение наподобие:

Error unmounting block device 8 : 17 : GDBus . Error : org . freedesktop . UDisks2 . Error . DeviceBusy : Error unmounting / dev / sdb1 : target is busy

Оно говорит о том, что некое приложение все еще использует носитель / dev / sdb1 . Чтобы определить это приложение, нужно найти, куда смонтирован / dev / sdb1 :

Как принудительно размонтировать раздел в Linux (umount — device is busy)

linux-logo

Сегодня поговорим о том, как принудительно размонтировать разделы в Linux. Если при вводе команды umount выводится сообщение о занятости устройства (device is busy), то вам сюда .

Иногда не получается размонтировать раздел или диск, так как выходит ошибка о занятости устройства:

umount: /mnt/disk: device is busy

Чтобы размонтировать ваш диск или раздел, в терминале набираем команду для принудительного размонтирования:

sudo umount -l /mnt/disk
  • /mnt/disk – путь монтирования или путь до диска

Если команда выше не помогла, то пробуем ещё одну команду:

sudo umount -f /mnt/disk

Если есть вопросы, то пишем в комментариях в Телеграмм и ВК.

Ссылки в шапке страницы.
Заранее всем спасибо.

RSS

  • Как запустить команду в фоне в Linux
  • Ошибка несоответствие размеров GPT PMBR
  • nginx: [warn] protocol options redefined
  • Как включить поддержку linux в windows 11
  • Запускаем скрипт после запуска сети Ubuntu 22.04

Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.

linux-logo

Сегодня в статье настроим и русифицируем Ubuntu Server 16.04/18.04/20.04. Чтобы поддерживался русский язык, и перевод системы стал русским

dns_bind9

Начиная с сентября 2017 года удостоверяющим центрам предписано обязательно проверять CAA-записи в DNS перед генерацией сертификата

linux-logo

В этой статье рассмотрим пример обновления Ubuntu Server 16.04 до Ubuntu Server 18.04 Все наши действия нам придется выполнять из Читать

В связи с последними блокировками IP-адресов Роскомнадзором, встала необходимость завести свой собственный VPN сервер. Если VPN у вас ещё не Читать

Не могу размонтировать раздел в Linux: umount — device is busy

При попытке размонтировать раздел в Linux с помощью команды umount может появится ошибка device is busy:

umount: /mnt/sda2: device is busy

не могу отмонтировать раздел в Linux - device is busy

umount: /dev/sda2: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

В данный момент это устройство используется каким-то запущенным процессом/программой и вы не можете от монтировать его.

Попробуйте найти процесс, который используется ваше устройство с помощью команды:

$ lsof +D | grep /dev/sda2

Или с помощью fuser:

$ fuser -vm /dev/sda2

Вы получите список PID процессов, которые сейчас используют этот диск. Завершите эти процессы:

Попробуйте размонтировать устройство:

$ sudo umount /dev/sda2

Если это не помогло, можно принудительно от монтировать такой раздел или устройство (может вызвать потерю данных в открытых файлах. Есть два варианта размонтирования устройства:

Lazy unmount: # umount -l /dev/sda2 в этом режиме Linux ждет прячет от системы точку монтирования и ждет когда будут закрыты все файловые дескрипторы на указанном устройстве.

Force: # umount -f /dev/sda2 – принудительное размонтирование (часто это единственный способ отключить NFS диск, который стал недоступным)

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *