zoukankan      html  css  js  c++  java
  • linux如何使用umount命令强制卸载文件系统

    转载来自http://www.xitongzhijia.net/xtjc/20150610/50557.html

    umount命令

      解挂文件系统。umount [-ahnrvV][-t 《文件系统类型》][文件系统]

      umount可卸除目前挂在Linux目录中的文件系统。

      线上在用的nfs访问时出了问题,导致/data1目录ls都无法进行输出,需要进行卸载掉 。而直接卸载时由于目录正被其他进程占用 ,无法直接umount,这里就结合fuser进行umount卸载。

      1、直接卸载

      [root@localhost /]# umount /data1/img

      umount: /data1/img: device is busy

      umount: /data1/img: device is busy

      2、提示被占用,使用强制卸载

      [root@localhost /]# umount -f /data1/img

      umount2: Device or resource busy

      umount: /data1/img: device is busy

      umount2: Device or resource busy

      umount: /data1/img: device is busy

      注:使用-f 参数进行强制卸载时一般建议等一会儿再进行下面的操作,一些情况下处理需要1-2分钟的时间。

      3、使用umount -f,问题依旧。使用fuser命令,先确认有那些进程在占用该目录

      [root@localhost /]# fuser -cu /data1/img

      /data1/img: 1757c(mysql)

      上面查看发现是pid为1757的mysql用户起的进程在占用该目录。

      4、确认mysql所起的进程可以kill 后,可以直接使用fuser 的k参数进行kill (也可以手动停掉1757进程再卸载)

      [root@localhost /]# fuser -ck /data1/img

      /data1/img: 1757c

      注:这里k 就是kill的意思,注意没进行确认前要谨慎使用该参数。

      另外,umount异常时,也经常会用到 lsof 指定确认文件被什么进程占用

      上面就是Linux使用umount命令强制卸载文件系统的方法,即使提示被占用也照样能够通过命令来卸载。

  • 相关阅读:
    2.Android之按钮Button和编辑框EditText学习
    《DSP using MATLAB》Problem 3.8
    《DSP using MATLAB》Problem 3.7
    《DSP using MATLAB》Problem 3.6
    《DSP using MATLAB》Problem 3.5
    《DSP using MATLAB》Problem 3.4
    《DSP using MATLAB》Problem 3.3
    《DSP using MATLAB》Problem 3.2
    《DSP using MATLAB》Problem 3.1
    《DSP using MATLAB》Problem 2.20
  • 原文地址:https://www.cnblogs.com/ss-33/p/13884639.html
Copyright © 2011-2022 走看看