Error unmounting filesystem linux

Содержание
  1. How do I forcefully unmount a Linux disk partition?
  2. Understanding device error busy error
  3. How do I list the users on the file-system /nas01/?
  4. Linux fuser command to forcefully unmount a disk partition
  5. Непонятки с диском-появилась ошибка
  6. Непонятки с диском-появилась ошибка
  7. Непонятки с диском-появилась ошибка
  8. Непонятки с диском-появилась ошибка
  9. Непонятки с диском-появилась ошибка
  10. Непонятки с диском-появилась ошибка
  11. Непонятки с диском-появилась ошибка
  12. Непонятки с диском-появилась ошибка
  13. Непонятки с диском-появилась ошибка
  14. Непонятки с диском-появилась ошибка
  15. Непонятки с диском-появилась ошибка
  16. Непонятки с диском-появилась ошибка
  17. Непонятки с диском-появилась ошибка
  18. Непонятки с диском-появилась ошибка
  19. Непонятки с диском-появилась ошибка
  20. Непонятки с диском-появилась ошибка
  21. Re: Непонятки с диском-появилась ошибка
  22. How to mount and umount a file system in Linux
  23. Unmount a File System
  24. Force Umount the file systems
  25. View Currently Mounted File Systems
  26. umount /dev: Invalid argument
  27. 1 Answer 1

How do I forcefully unmount a Linux disk partition?

S ometimes you try to unmount a disk partition or mounted CD/DVD disk or device, which is accessed by other users, then you will get an error umount: /xxx: device is busy. However, Linux or FreeBSD comes with the fuser command to kill forcefully mounted partition. For example, you can kill all processes accessing the file system mounted at /nas01 using the fuser command.

Understanding device error busy error

Linux / UNIX will not allow you to unmount a device that is busy. There are many reasons for this (such as program accessing partition or open file) , but the most important one is to prevent the data loss. Try the following command to find out what processes have activities on the device/partition. If your device name is /dev/sdb1, enter the following command as root user:
# lsof | grep ‘/dev/sda1’
Output:

Above output tells that user vivek has a vi process running that is using /dev/sda1. All you have to do is stop vi process and run umount again. As soon as that program terminates its task, the device will no longer be busy and you can unmount it with the following command:
# umount /dev/sda1

How do I list the users on the file-system /nas01/?

Type the following command:
# fuser -u /nas01/
# fuser -u /var/www/
Sample outputs:

The following discussion allows you to unmout device and partition forcefully using mount or fuser Linux commands.

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Linux fuser command to forcefully unmount a disk partition

Suppose you have /dev/sda1 mounted on /mnt directory then you can use fuser command as follows:

Type the command to unmount /mnt forcefully:
# fuser -km /mnt
Where,

  • -k : Kill processes accessing the file.
  • -m : Name specifies a file on a mounted file system or a block device that is mounted. In above example you are using /mnt

Linux umount command to unmount a disk partition.

You can also try the umount command with –l option on a Linux based system:
# umount -l /mnt
Where,

  • -l : Also known as Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. This option works with kernel version 2.4.11+ and above only.
Читайте также:  Как удалить файлы ubuntu linux

If you would like to unmount a NFS mount point then try following command:
# umount -f /mnt
Where,

  • -f: Force unmount in case of an unreachable NFS system

Please note that using these commands or options can cause data loss for open files; programs which access files after the file system has been unmounted will get an error.

Источник

Непонятки с диском-появилась ошибка

Установил ОС Линукс Минт 19.3-все работает нормально,но сегодня, при попытке исправить ошибки на диске, получил сообщение-error unmounting/dev/sda5:target is busy (udisks-error-quark,14) Что это такое и что с ним делать.Я не спец и поэтому спрашиваю в надежде что кто-нибудь подскажет решение.

Для выполнения проверки файловой системы на ошибки её нужно отмонтировать (отключить).

Если /dev/sda5 у тебя смонтирована как корневая файловая система или какая-либо часть корневой файловой системы, то тогда тебе нужно грузиться с LiveCD / LiveUSB диска и запускать проверку файловой системы на /dev/sda5.

Непонятки с диском-появилась ошибка

Да,смонтировано на Корень файловой системы. А если я отключу раздел(отмонтирую) данные не пропадут? Режим запущу и проверю раздел. Заранее благодарю.

А если я отключу раздел(отмонтирую) данные не пропадут?

Ничего не пропадёт если просто нормально отмонтировать. Другой вопрос, что там за ошибки появились, тут может и пропасть кое-что. И ещё вопрос: как раздел удалось примонтировать если он с ошибками, read only?

Непонятки с диском-появилась ошибка

А не легче будет ПОЛНОСТЬЮ переустановить систему?Как они,ошибки,появились?Я думаю,что просто до этого неправильно удалил один раздел-надо было в GParted,а я просто удалил в утилите Диски.

Если у тебя аппаратные проблемы с ЖД, переустановка системы не поможет от слова совсем.

Ты крайне невнятно описал проблему. Давай немного выводов:

Здесь тебе нужно подробнее рассказать, что делал и зачем.

Про переустановку Всеволод тебе пояснил.

Пусть сперва те выводы скинет, что я выше просил, узнаем хоть, как и что примонитровано. Попробуем прочекать после его ФС.

Потом надо быдет ещё smartmontools поставить и SMART у диска глянуть, если будет такая возможность.

А у Тебя далеко идущие планы :).

Ой, обычная ситуация. Смотрим сперва ФС, потом ЖД. Возможно, все не страшно и обойдется чеком.

Непонятки с диском-появилась ошибка

Хм, сейчас корень примонтирован у тебя в rw. Ладно, а что именно ты пытался исправить на диске, когда получил эту ошибку?

Непонятки с диском-появилась ошибка

Просто при попытке обновления-в частности ядра-получил это сообщение об ошибке.Да и при попытке исправить в утилите Диски получил эту ошибку.У меня один вопрос-с этой ошибкой «жить и работать» можно?Это я о компе.Сейчас ядро 5.4.0-48.

Непонятки с диском-появилась ошибка

Можно еще вопрос?Диск в норме?

Пока не знаю. У тебя какие-то непонятки с нумерацией разделов, ХЗ, чем вызваны. Но вроде не должны сильно мешать.

Все исправления/изменения производятся только на отмонтированных разделах, тут мог Диск и ругнуться.

А вот как ты ядро обновлял?

Непонятки с диском-появилась ошибка

Че? apt тут при чем? Я тебя какую команду выполнить просил?

Непонятки с диском-появилась ошибка

Ядро пытался обновить,но получил эту ошибку.Сейчас версия ядра 5.4.0-48

Что за ****** ты несешь?

Я так понимаю, эту ошибку можно получить при попытке отмонтировать раздел который в данный момент используется. Зачем его пытались отмонтировать?

sudo blkid -c /dev/null

Непонятки с диском-появилась ошибка

МЫ ПОТЕРЯЛИ ЕГО.

Непонятки с диском-появилась ошибка

Это я не тебе 🙂 ты просто долго не отвечал.

Непонятки с диском-появилась ошибка

Как ты пытался ядро обновить??

Непонятки с диском-появилась ошибка

Пришло обновление,пытался обновиться-получил эту ошибку. При попытке исправить в утилите Диски-этаже ошибка.

Непонятки с диском-появилась ошибка

Окей, я убедился. Теперь имеет смысл чекнуть ФС на ошибки. В Linux Mint это просто — в меню GRUB2 при загрузке выбираем rescue режим, а там fsck.

Читайте также:  Живые обои для windows 10 мадара

Непонятки с диском-появилась ошибка

Ну, мужик, Всеволод тебе написал — в rescue!!

Непонятки с диском-появилась ошибка

Ребята!Не ругайте меня сильно!Я прочитал,но как туда попасть-не знаю.Где взять этот grub2,если при загрузке я его НЕ ВИЖУ.

Esc нажать после BIOS. Выбрать rescue, там далее отдельный пункт fsck, чтобы вообще все за тебя автоматика сделала.

Или recovery — я уже забыл, как там это называется.

Непонятки с диском-появилась ошибка

Re: Непонятки с диском-появилась ошибка

Я бы туда не полез. Там темно и страшно, и гуя нету. Да и всё равно ОСь лучше переустановить, предварительно вдумчиво запланировав разметку. А то этот единственный пятый, да ещё на расширенном разделе, с имеющимися ошмётками под закос использования efi (остатки виндовсы, да?) — это как бы абздец в фундаменте твоей стройки. Оно, может быть, и так бы работало, но не всякое «ядро» при обновлении научено понимать такие замесы конструкций. Вот и не поняло чиво тут и где.

error unmounting/dev/sda5:target is busy

Подёргай шлейф, либо попробуй поменять интерфейсный кабель.

Можно также попробовать посмотреть в каком процессе участвует диск и попробовать придушить его.

Источник

How to mount and umount a file system in Linux

A file system residing on a SATA/PATA or SCSI device needs to be mounted manually to access it. The mount command allows the root user to manually mount a file system. The first argument of the mount command specifies the file system to mount. The second argument specifies the target directory where the file system is made available after mounting it. The target directory is referred to as a mount point.

The general syntax for mounting a file system with mount is:

By using mount, you can override the default settings in /etc/fstab. For example, entering the following mounts the partition /dev/sdd1 to the directory /data:

You do not usually specify the file system type because it is recognized automatically (using magic numbers in the superblock, or simply by trying different file system types; see man mount for details).

The following are some of the options you can use when mounting a file system with the command mount or by entering them in /etc/fstab.

  • remount. This option causes file systems that are already mounted to be mounted again. When you make a change to the options in /etc/fstab, you can use remount to incorporate the changes.
  • rw, ro. These options indicate whether a file system should be writable (rw) or only readable (ro).
  • sync, async. These options set synchronous (sync) or asynchronous (async) input and output in a file system. The default setting is async.
  • atime, noatime. These options set whether the access time of a file is updated in the inode (atime) or not (noatime). The option noatime should improve the performance.
  • nodev, dev. The nodev option prevents device files from being interpreted as such in the file system.
  • noexec, exec. You can prohibit the execution of programs on a file system with the option noexec.
  • nosuid, suid. The nosuid option ensures that the suid and sgid bits in the file system are ignored.

Some options only make sense in the file /etc/fstab. These options include the following:

  • auto, noauto. File systems set with the option noauto in the file /etc/fstab are not mounted automatically when the system is booted.
  • user, nouser. This option lets users mount the file system. Normally, this is a privilege of the user root.
  • defaults. This option causes the default options rw, suid, dev, exec, auto, nouser, and async to be used.

The options noauto and user are usually combined for removable media such as floppy disk or CD-ROM drives.

Читайте также:  Как создать второй рабочий стол без иконок windows 10

Unmount a File System

Once a file system is mounted, you can use the umount command (without an “n”) to unmount the file system. You can unmount the file system by using umount with the device or the mount point.
For example to unmount a file system (dev/sdd1) mounted at /data, you could enter one of the following:

In order to unmount the file system, no application or user may use the file system. If it is being used, Linux sees the file system as being “busy” and will refuse to unmount the file system and will produce the below error.

Unmounting is not possible if the mount point is accessed by a process. For umount to be successful, the process needs to stop accessing the mount point.

The lsof command lists all open file and processes accessing them in the provided directory. It is useful to identify which processes currently prevent the file system from successful umounting.

You can also use the fuser command to get the process IDs of the processes currently running on the mpunt point you want to umount.

You can also kill all the processes on the mount point using the fuser command.

Once the processes are identified, an action can be taken, such as waiting for the process to complete or sending a SIGTERM or SIGKILL signal to the process. In this case, it is sufficient to umount the mount point.

Force Umount the file systems

There might be times when the system (kernel) sees the file system as busy, no matter what you try to do. In these cases, you can enter umount -f to force the file system to unmount. However, we recommend using this only as a last resort, as there is probably a reason why the kernel thinks the file system is still mounted.

View Currently Mounted File Systems

You can view the file systems currently mounted by entering the command mount. Information similar to the following appears:

You can also view this information in the file /proc/mounts.

Источник

umount /dev: Invalid argument

I would like to chroot to another rootfs and unmount the former one so, after mounting a SD card containing a rootfs (on /mnt/disk/ ) and killing almost every process, I tried to run:

and then, mount —move /dev /mnt/disk/dev which fails with the error message:

mount: mounting /dev/ on /mnt/disk/dev failed: No such file or directory

Some more information:

I also tried umount /dev giving

umount: can’t umount /dev/: Invalid argument
# (same error with /dev/root)

The former rootfs is on a NAND partition (JFFS2)

mount -t jffs2 /dev/mtdblock3 /mnt/disk/dev works (mounts the former root) Could it be related to a filesystem conflict between the SD card and the root partition ?

rootfs / rootfs rw 0 0
/dev/root / jffs2 rw 0 0
/proc /mnt/disk/proc proc rw 0 0
/sys /mnt/disk/sys sysfs rw 0 0
/dev/mmcblk0p0 /mnt/disk ext2 rw,errors=continue 0 0

1 Answer 1

There is no filesystem mounted at /dev , therefore you cannot unmount it or move it. That is what these error messages mean. (Possibly busybox mount uses more generic error messages than its heavyweight counterpart).

If the target /dev/ isn’t going to have the device nodes you need, hopefully you have a MAKEDEV in there you can use.

If you try copying them from the original /dev/ using cp -a , there’s a risk that the UIDs will not match the target rootfs, and hence permissions won’t work as desired for non-root users. (Less secure or «so secure it doesn’t work»).

Источник

Оцените статью