[linux]umount 時 出現 “Device is busy”

當任何目錄有 mount, 然後有程式 使用/掛 在那個目錄上的話, 就沒有辦法 umount 掉, 於 umount 時會出現 Device is busy 的訊息.

要怎麼找出是哪個程式掛在那個目錄上? 然後去把那個程式砍掉呢?

假設現在 mount 起來的目錄是 /opt/data

  • 查詢: fuser -m /opt/data
  • 顯示: /opt/data: 698434c 699200c 699220c

數字代表程序, 而後面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.

再用 #kill -9 698434 將程序刪除後即可umount

#umount /opt/data