歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> device is busy時怎麼辦

device is busy時怎麼辦

日期:2017/3/1 15:53:17   编辑:關於Linux
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: 多謝pnt的提醒,原來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.)
Copyright © Linux教程網 All Rights Reserved