umount device is busy错误处理
umount device is busy 错误的原因是有进程调用了挂载的设备,可以通过查看哪些进程调用了该文件将进程杀掉重新umount 即可
umount /data/program/tomcat6/webapps/ROOT/msgp_w_picpath
umount: /data/program/tomcat6/webapps/ROOT/msgp_w_picpath: device is busy
fuser 命令查看文件或目录被哪些进程打开
fuser /data/program/tomcat6/webapps/ROOT/msgp_w_picpath
/data/program/tomcat6/webapps/ROOT/msgp_w_picpath: 21931c
kill -9 21931 或 fuser -k /data/program/tomcat6/webapps/ROOT/msgp_w_picpath
umount /data/program/tomcat6/webapps/ROOT/msgp_w_picpath
成功卸载
21931c 后面的c是用来表示程序是以什么方式来使用目录或文件
PID后跟的字符说明了进程以何种方式与该目录/文件关联,有以下关联方式:
c指示进程的工作目录
e指示该文件为进程的可执行文件(即进程由该文件拉起)
f指示该文件被进程打开,默认情况下f字符不显示
F指示该文件被进程打开进行写入,默认情况下F字符不显示
r指示该目录为进程的根目录
m指示进程使用该文件进行内存映射,抑或该文件为共享库文件,被进程映射进内存
fuser的详细使用
-a display unused files too
-c mounted FS
-f silently ignored (for POSIX compatibility)
-i ask before killing (ignored without -k)
-k kill processes accessing the named file
-l list available signal names
-m show all processes using the named filesystems
-n SPACE search in this name space (file, udp, or tcp)
-s silent operation
-SIGNAL send this signal instead of SIGKILL
-u display user IDs
-v verbose output
-V display version information
fuser -v /root 详细输出
USER PID ACCESS COMMAND
/root: root 14629 ..c.. java
fuser -v -n tcp 80 详细输出tcp协议使用80端口的进程
USER PID ACCESS COMMAND
80/tcp: root 22975 F.... java
fuser -m /dev/sda10 输出文件系统被哪些进程使用
/dev/sda10: 14629e 16151ce 22158c 22975ce 22976ce 26687ce 28879e
fuser -m -k /dev/sda10 杀死使用文件系统的进程
/dev/sda10: 14629e 16151ce 22158c 22975ce 22976ce 26687ce 28879e
本文介绍了fuser工具的用法,fuser可用于查询文件、目录、socket端口和文件系统的使用进程,并且可以使用fuser关闭进程。
当文件系统umount报device busy时,常用到fuser查询并关闭使用相应文件系统的进程。
转载于:https://blog.51cto.com/buguoruci/1260581