device is busy時怎麼辦

來源:互聯網
上載者:User

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.)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.