坚持以客户需求至上原则
中国老牌优质服务商

device is busy的解决办法

linux下的磁盘分区通过挂载(mount)的方式连到一个目录下,打开此目录就可以看到磁盘分区中的内容了。与挂载相反的操作是umount,他将磁盘分区与目录的关联关系解除。
但有时候umount时会报错误,例如
Code:
# umount /usr/local/
umount: /usr/local: device is busy
这说明还有某个程序正在是用此目录,为了保证程序的运行,默认情况下umount不能卸载。但是umount又没有说究竟哪个程序在使用,觉得这也算是设计的一个缺陷。
幸好有个程序叫fuser,man fuser的介绍是:
Code:
fuser – identify processes using files or sockets
fuser后加需要查的资源就可以知道有哪些进程正在使用了,例如:
Code:
#fuser -m /
/:                    8892r  8916r  8932r  8959r  8992rc  8996rc  8997rc  8999rc  9006rc
   9007rc  9010rc  9013r  9015rc  9025r  9029r  9033rc  9035r  9039rc  9058rc  9107rc
   9109rc  9126rc  9130r  9366r  9375r  9439r
接下来需要做的就是将相关进程停掉,再umount即可。
PS: umount 还有一个-l选项,作用是当需卸载文件系统的引用不繁忙时直接卸载:
Code:
umount -l    Lazy unmount. Detach the filesystem from the filesystem  hierar-
chy now, and cleanup all references to the filesystem as soon as
it is not busy anymore.  (Requires kernel 2.4.11 or later.)
赞(10)

更专业 更快速 更方便

华夏名网VIP服务