umount移动硬盘遇到device is busy问题

时间:2023-03-09 18:19:05
umount移动硬盘遇到device is busy问题

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

fuser 概述
fuser命令是用来显示所有正在使用着指定的file, file system 或者 sockets的进程信息。
例:
#fuser -m -u /mnt/fourt
/mnt/fourt:          14917c(root) 14918c(root)
在例子中,使用了-m和-u选项,用来查找所有正在使用/mnt/fourt 的所有进程的PID,以及该进程的OWNER,如14917c(root),其中14917是进程PID,root是该进程的OWNER。
fuser会显示正在使用指定的file,file system 或者 sockets的进程的PID。在默认的显示模式下,每个文件名之后会跟随一个字符,用来指示当前的访问类型。
如下所示:
c
    current directory.
e
    executable being run.
f
    open file.
F
    open file for writing.
r
    root directory.
m
    mmap'ed file or shared library
    
    
查看进程使用的文件:    
# ls -al /proc/14917/fd/
total 0
dr-x------ 2 root  root    0 Jul 28 09:58 .
dr-xr-xr-x 7 root screen  0 Jul  8 12:44 ..
lr-x------ 1 root  root   64 Jul 28 09:58 0 -> /dev/null
l-wx------ 1 root  root   64 Jul 28 09:58 1 -> /dev/null
l-wx------ 1 root  root   64 Jul 28 09:58 2 -> /dev/null
lr-x------ 1 root  root   64 Jul 28 09:58 3 -> /var/run/screen/S-aimin/14917.pts-6.centos64
lrwx------ 1 root  root   64 Jul 28 09:58 5 -> /dev/ptmx
lr-x------ 1 root  root   64 Jul 28 09:58 6 -> /var/run/utmp

# ls -al /proc/14918/fd/
total 0
dr-x------ 2 root root  0 Jul 28 09:58 .

#ps --ppid 14917
#ps --ppid 14918

kill进程:
#kill -9 14917
#kill -9 14918

再次umount

#umount  /mnt/fourt