Find who blocks umount

Show the processes that cause the "device busy" error on umount; pass the mount point path

lsof /mnt/<name>

tool
lsof19 commands
tags
lsofdisktroubleshootingdebug

More lsof commands

  • lsof -t -i:<port> | xargs -r kill

    Kill the process that holds a port; -t prints only PIDs, -r skips kill if nothing is found

  • lsof -nP -i -sTCP:CLOSE_WAIT

    Find sockets that the app forgot to close; a growing CLOSE_WAIT count means an fd or connection leak

  • lsof -nP -i @<host>:<port>

    Show only sockets that talk to a specific host and port

  • lsof -p <pid> -a -d txt,mem

    Show only the executable and the loaded shared libraries; -a joins the filters with AND, useful after a deploy

  • lsof -nP -p <pid> | wc -l

    Quick fd count to compare with ulimit -n and spot leaks; even faster: ls /proc/<pid>/fd | wc -l

all 19 lsof commands