umount卸载失败:umount: /mnt: target is busy.(入职小灰)

版权声明:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37960324/article/details/82252346

程序占用导致卸载失败问题

因为linux支持多用户登录,当用户在使用挂载的目录是,想卸载它,O(∩_∩)O哈哈~不可能的事

umount卸载失败:umount: /mnt: target is busy.

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

分析:找到当前登录用户

[root@test01 mnt]# w
 10:09:07 up  1:20,  2 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1                      08:49    1:19m  0.18s  0.18s -bash
root     pts/0    10.0.0.1         09:11    3.00s  0.07s  0.01s w
可以看出,有一个root用户是无效的

不知道什么原因,应该重启可以恢复,但保障起见

还是设置应该无效用户自动退出脚本

[root@test01 mnt]# vim /etc/profile.d/autologout.sh

TMOUT=10
readonly TMOUT
export TMOUT

加上执行权限

[root@test01 mnt]# chmod +x /etc/profile.d/autologout.sh

重启系统:reboot

再次登录时

[c:\~]$ 

Connecting to 10.0.0.100:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Fri Aug 31 09:11:19 2018 from 10.0.0.1
[root@test01 ~]# w
 10:13:00 up 1 min,  1 user,  load average: 0.21, 0.12, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    10.0.0.1         10:12    4.00s  0.02s  0.00s w
无效的root用户被自动下线

再来卸载

[root@test01 ~]# umount /mnt
[root@test01 ~]# 
[root@test01 ~]# 
 

卸载成功。

总结:磁盘卸载多半是用户占用问题,最好的解决方法就是让使用的用户强制下线,再来卸载。

(~ ̄▽ ̄)~

猜你喜欢

转载自blog.csdn.net/qq_37960324/article/details/82252346
今日推荐