有時候 USB DiskonKey 或是遠端分享目錄掛載( mount )後怎麼樣都無法移除掛載( umount ),就像是下面所出現的提示訊息一樣.
[root@benjr media]# umount /media/ unmount error 16 = Device or resource busy Refer to the umount.cifs(8) manual page (man 8 umount.cifs) |
這不能移除掛載的狀況有很多有可能是程式還在該目錄下做存取或是檔案已經被開啟的狀態中..等等的情況都有可能.此時我們可以透過 "Fuser" 指令來查出到底是什麼原因讓該目錄無法移除掛載.
[root@benjr media]# fuser -m /media/ /media/: 849c |
原來是 PID(Process ID) 849 這麼程式讓該目錄除法移除掛載.那後面的 c 是代表什麼呢!!
c current directory.
e executable being run.
f open file. f is omitted in default display mode.
F open file for writing. F is omitted in default display mode.
r root directory.
m mmap'ed file or shared library.
先查一下 PID 849 是在做什麼,之後你自己就可以決定是不是要用 kill 來移除這一程序.
[root@benjrmedia]# ps -auxw |grep 849 Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ root 849 0.0 0.0 66096 1584 pts/4 Ss 16:52 0:00 bash root 2075 0.0 0.0 61188 752 pts/4 S+ 23:54 0:00 grep 849 |
或是直接加參數 -k ,移除該程序.
[root@benjr media]# fuser -kvm /media/ |