Less known Solaris Features: fuser
You know the problem. You try to unmount a filesystem, but all you get is a “Device Busy”. How do you find the process blocking the unmount?
fusers enables you to look for the processes that access a directory or a file. For example we can check for all processes using the
/ filesystem as their “working filesystem”:
I´m sure you alread assume, that the numbers stand for the process id´s. But what does all that letters mean. I will cite the manpage for this:
- c: Indicates that the process is using the file as its current directory.
- m: Indicates that the process is using a file mapped with mmap(2).
- n: Indicates that the process is holding a non-blocking mandatory lock on the file.
- o: Indicates that the process is using the file as an open file.
- r: Indicates that the process is using the file as its root directory.
- t: Indicates that the process is using the file as its text file.
- y: Indicates that the process is using the file as its controlling terminal. </ul>
But fuser can do more for youOkay, now you know which processes uses a filesystem. But let´s assume you have to unmount a filesystem for maintaining the storage. But there are still some users, who didn´t read their mails and you can´t unmount it.
Dammit ... Okay, let´s check for the offending processes:
And now comes the kicker: fuser can kill all processes using a certain file or directory. You warned your users ...
Now we can unmount the directory:
A neat trick with fuserOkay, working with PID may a little bit cumbersome. Pete Shanahan posted a neat trick a long time ago. Let´s assume the example with the both
sleepprocesses. You´ve remounted the filesystem an started some programs while beeing in the
Do you want to learn more ?docs.sun.com: fuser(1M)
Pete Shanahan´s fuser trick</a