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

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

因为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 ~]# 
 

卸载成功。

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

(~ ̄▽ ̄)~

 

  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值