centos7执行umount提示:device is busy或者target is busy
问题描述:
系统盘sda2挂载到/mnt/disk1 目录下 想取消
1.[root@localhost ~]# lsblk -l #查看挂载
2.[root@localhost ~]#umount /mnt/disk1 #返回报错
umount: /mnt: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
解决方案:
1.[root@localhost ~]#fuser -m /mnt/disk1 #根据提示使用fuser命令
-bash:fuser: command not found
2.[root@localhost ~]#yum install-y psmisc #安装fuser
关于fuser的介绍:
fuser 可以显示出当前哪个程序在使用磁盘上的某个文件、挂载点、或者网络端口,并给出程序进程的详细信息.
3.[root@localhost ~]# fuser -mv -k /mnt/disk1/ #运行后可能需要重启服务器
使用fuser -mv -k /mnt 先杀死使用该目录的所有进程,然后在执行卸载操作
-m 后跟一个目录、文件或者设备名,列出使用该文件的进程PID
-v 显示详细信息
-k 杀死使用指定文件的所有进程
4.[root@localhost ~]# umount /mnt/disk1 #执行umount 成功
5.[root@localhost ~]# lsblk -l #再次查看挂载