强行卸载目录

背景

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终极手法

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容