If you ever run in the situation where you try to unmount a filesystem but the umount command tells you the 'device is busy' the
fuser command might be helpful.
fuser provides information about the process keeping the filesystem busy by returning you the process-id's. Piping the process-id's to the
ps command you can determine more information about each process.
An example: We have a mount point
/www which we try to unmount:
umount /www
result:
umount: /www: device is busy
Now to determine which process is keep the filesystem busy we type:
fuser -c /www
In my example the result is:
/www: 8679 8681m 8682m 8683m 8684m 8685m 8686m 8687m 8688m 8705
We can find out more about these processes using
ps. We can put it all into one commandline:
ps -lf -p $(fuser -c /www 2>/dev/null)
to show you the detailed information:
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
5 S root 8679 1 0 78 0 - 16588 - 10:51 ? 0:00 /usr/sbin/httpd
5 S apache 8681 8679 0 75 0 - 17461 semtim 10:51 ? 0:02 /usr/sbin/httpd
5 S apache 8682 8679 0 75 0 - 17169 semtim 10:51 ? 0:01 /usr/sbin/httpd
5 S apache 8683 8679 0 75 0 - 17169 semtim 10:51 ? 0:01 /usr/sbin/httpd
5 S apache 8684 8679 0 75 0 - 17036 - 10:51 ? 0:00 /usr/sbin/httpd
5 S apache 8685 8679 0 75 0 - 17036 semtim 10:51 ? 0:00 /usr/sbin/httpd
5 S apache 8686 8679 0 75 0 - 17036 semtim 10:51 ? 0:00 /usr/sbin/httpd
5 S apache 8687 8679 0 76 0 - 17191 semtim 10:51 ? 0:00 /usr/sbin/httpd
5 S apache 8688 8679 0 75 0 - 17833 semtim 10:51 ? 0:01 /usr/sbin/httpd