【Linux】umount 提示:device is busy 的处理方法(In some cases useful info about processes that use )

Linux安全运维 (1065) 2024-04-30 15:29:20

问题描述

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

1、执行取消挂载

[root@hdp01 centos7]# umount /var/centos7/
umount: /var/centos7: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

【Linux】umount 提示:device is busy 的处理方法(In some cases useful info about processes that use )_https://www.tiejiang.org_Linux安全运维_第1张

2、强制卸载

[root@hdp01 centos7]# umount /var/centos7/ -f
umount: /var/centos7: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

3、查看进程占用

[root@hdp01 centos7]# fuser -m /var/centos7/
/var/centos7:        21746c

4、取消磁盘挂载的全流程

[root@hdp01 centos7]# umount /var/centos7/
umount: /var/centos7: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@hdp01 centos7]# df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       40G  4.3G   34G  12% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  404K   16G   1% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
tmpfs           3.2G     0  3.2G   0% /run/user/0
/dev/xvdb1      492G   28G  439G   6% /var
/dev/loop0      9.6G  9.6G     0 100% /var/centos7
[root@hdp01 centos7]# umount /var/centos7/
umount: /var/centos7: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@hdp01 centos7]# umount /var/centos7/ -f
umount: /var/centos7: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@hdp01 centos7]# fuser -m /var/centos7/
/var/centos7:        21746c
[root@hdp01 centos7]# ps aux | grep 21746
root     21746  0.0  0.0 117528  2212 pts/2    Ss   May12   0:00 -bash
root     27307  0.0  0.0 114692   960 pts/2    S+   10:25   0:00 grep --color=auto 21746
[root@hdp01 centos7]# kill -9 21746
Connection to hdp01 closed.
[root@hdp01 yum.repos.d]# ps aux | grep 21746
root     27312  0.0  0.0 114692   956 pts/0    S+   10:26   0:00 grep --color=auto 21746
[root@hdp01 yum.repos.d]# umount /var/centos7/
[root@hdp01 yum.repos.d]# df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       40G  4.3G   34G  12% /
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  380K   16G   1% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
tmpfs           3.2G     0  3.2G   0% /run/user/0
/dev/xvdb1      492G   28G  439G   6% /var

5、图示说明

【Linux】umount 提示:device is busy 的处理方法(In some cases useful info about processes that use )_https://www.tiejiang.org_Linux安全运维_第2张

最后成功 OK

THE END

发表评论