Системным администраторам иногда приходится сталкиваться с проблемой демонтирований диска или смонтированной сетевой шары.
Пытаюсь демонтировать:
umount /my_path
Неудача:
umount: /my_path: device is busy.
(In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))
Процессов, использующих устройство я не нашёл:
lsof | grep "/my_path"
lsof +D | grep "/my_path"
fuser -m /my_path
На первый взгляд всё нормально, но папка не хочет демонтироваться. Причём так сильно залипло, что даже команда df
не хочет отрабатывать.
На помощь приходит ленивое или принудительное демонтирование. Если вы уверены, что хотите принудительно демонтировать папку, вы можете использовать флаг -l (lazy unmount) или -f (force):
umount -l /my_path
или:
umount -f /my_path
Вы должны быть на 100% уверены в том что делаете. Эти действия могут привести к потере данных.
Из мануала umount:
-l, --lazy
Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore.
A system reboot would be expected in near future if you’re going to use this option for network filesystem or local filesystem with submounts. The
recommended use-case for umount -l is to prevent hangs on shutdown due to an unreachable network share where a normal umount will hang due to a downed
server or a network partition. Remounts of the share will not be possible.
-f, --force
Force an unmount (in case of an unreachable NFS system).
Note that this option does not guarantee that umount command does not hang. It’s strongly recommended to use absolute paths without symlinks to avoid
unwanted readlink(2) and stat(2) system calls on unreachable NFS in umount.