强行卸载目录

背景

strace ls /data/aquaman ,到这个目录就卡住 了
现在这台机器执行 df -h \ ls /data/aquaman 都卡住了

处理

目录下有个目录
/data/aquaman/whatsapp 为挂载的阿里云nas.

mount 输出结果如下

7f8184a111-hvs85.ap-southeast-1.nas.aliyuncs.com:/ on /data/aquaman/whatsapp type nfs4 (rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.31.15.206,local_lock=none,addr=110.70.72.78)
  1. 强行删除或者umount
sudo rm -rf /data/aquaman/whatsapp
sudo umount -f /data/aquaman/whatsapp

卡住无反应

  1. 查看文件占用
lsof  # 卡住
(cd /proc; ls -d [0-9]* | xargs -n1 -i find {}/fd {}/cwd -type l -printf "{} %l\n") |grep /data/aquaman/wh
# 没有文件占用
  1. 直接强制umount
root@ubuntu:/home/qiantao# fuser -m -k -i -v /data/aquaman/whatsapp
Cannot stat /data/aquaman/whatsapp: Input/output error
# 报错无法使用

qiantao@ubuntu:~$ sudo umount -f /data/aquaman/whatsapp
umount.nfs4: /data/aquaman/whatsapp: device is busy
qiantao@ubuntu:~$ sudo umount -f -l /data/aquaman/whatsapp

Man Umount 查看f和l的参数说明如下:

       -f, --force
              Force an unmount (in case of an unreachable NFS system).  (Requires kernel 2.1.116 or later.)
       -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.  (Requires kernel 2.4.11 or later.)

参考文件

强制Umount NFS终极手法

你可能感兴趣的:(强行卸载目录)