执行umount 的时候却提示:device is busy 的处理方法

# umount /mnt/cdrom/
umount: /mnt/cdrom: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

# umount /mnt/cdrom/ -f    //强制卸载也不行
umount2: 设备或资源忙
umount: /mnt/cdrom: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
umount2: 设备或资源忙
# fuser -m /mnt/cdrom/
/mnt/cdrom/:          1338c
# ps aux |grep 1338
root      1338  0.0  0.2 108292  1912 pts/2    Ss+  14:27   0:00 -bash
root      1423  0.0  0.1 103236   884 pts/1    S+   14:49   0:00 grep 1338# kill -9 1338# fuser -m /mnt/cdrom
# umount /mnt/cdrom/# 

=========================================================
附fuser命令详解:
linux fuser
 
用fuser杀掉进程

一,为什么要使用fuser?
   先说 fuser的作用,fuser能识别出正在对某个文件或端口访问的进程
大家想一下,还有哪个命令具备这个功能? 没错,是lsof,我们前面讲过, lsof能够找出正在对指定文件访问的进程,
那么它们两者之间有何区别?
fuser有一个特别的用法在于它可以一次杀死那些正在访问指定文件的进程。   

二,如何使用fuser?

   1,如何用fuser得到正在使用指定文件的进程?
     用法: fuser 文件
     说明:它会把正在使用当前文件的进程id列出

     # umount /
     umount: /: device is busy.
           (In some cases useful info about processes that use
            the device is found by lsof(8) or fuser(1))
     # fuser /
      /:                       1rc     2rc     3rc     4rc     5rc     6rc     7rc    80rc    82rc    84rc    85rc   153rc   157rc   158rc
                               
                             
      说明:
      这些进程号后面的rc是什么意思?
      
      c 将此文件作为当前目录使用。 
      e 将此文件作为程序的可执行对象使用。 
      r 将此文件作为根目录使用。 
      s 将此文件作为共享库(或其他可装载对象)使用

  2,如何列出进程的详细信息,而不仅仅是进程id?-v参数即可
     说明: -v:  含义是:verbose output,详细的输出信息
     例子:

    # fuser /var/log
     /var/log:             4196c
   # fuser -v /var/log
      
                          USER        PID ACCESS COMMAND
     /var/log:            root       4196 ..c.. bash

   3,如何列出进程所属的用户?-u参数即可
    说明: -u: 含义:display user IDs,显示用户id
     
     例子:
    # fuser -u /var/log
     /var/log:             4196c(root)

     4,如何杀死所有正在访问指定文件的进程?-k参数即可
     说明: -k:含义: kill processes accessing the named file

     例子:

     # fuser -v /root/install.log
                          用户     进程号 权限   命令
     /root/install.log:   root       3185 f.... tail
     # fuser -k /root/install.log
     /root/install.log:    3185
   # fuser -v /root/install.log

     说明: -k参数能够杀死所有的正在访问指定文件的进程,所以用来杀进程时非常方便
     说明之二: fuser如何杀死的进程?
             它发送的是这个信号:SIGKILL



三,多学一点知识

    1,fuser可以列出它所知的信号:
     用 -l参数即可
     
     例子:
    # fuser -l
     HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM
     STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS
     UNUSED

    2,fuser可以发送它已知的信号给访问的指定文件进程而代替-k参数默认发送的SIGKILL
      例如:只是挂起进程,那么发送HUP信号就可以了
     
      例子:
     # fuser -v /root/install.log
                           用户     进程号 权限   命令
      /root/install.log:   root       3347 f.... tail
    # fuser -k -SIGHUP /root/install.log
      /root/install.log:    3347
     # fuser -v /root/install.log
原文地址:https://www.cnblogs.com/zq6041/p/6937248.html