Device busy when unmounting - better alternative to 'fuser'?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Device busy when unmounting - better alternative to 'fuser'?
I periodically have to remount a few of my partitions that might have a couple users logged into my system and doing various things on the file system in question. Most of the time they're just idling, and I don't want to have to track down all the various processes I have to terminate so I can reset the test environment.
Is there a better way to see all the processes that are using a particular device? fuser (and 'fuser -k') never work. I tried digging though the very long man page for 'ps' and didn't see anything useful. Ideally, I would like to be able to do this from a script so I can just run a "restart" script that does everything in few moments without to much down time.
Thanks for the help Tux! I tried this before but at first it didn't look like it listed everything. Upon further reading of the man page, I was able to list everything (including the alusive ssh and ftp connections) with 'lsof +D /mnt/directory'. Although it listed every file that was in use as well. Looks like it's time for some perl scripting.
You're welcome. I use it personally to kill things that are using automounted devices. I double checked it by running on something I was mplayering, but didn't think about that network stuff. How does it not list everything? Doing +D feels like overkill, and whenever I've used it, it would list anything that used anything on the device in /dev, even though the actual file opened is in /mnt.
Hmm, looks like I'm going to need to change my sig.
heh, sorry tuxdev. I guess now that I think about it, it would be a little weird if someone called me drk.
Quote:
How does it not list everything? Doing +D feels like overkill, and whenever I've used it, it would list anything that used anything on the device in /dev, even though the actual file opened is in /mnt.
Well it might help if I did it right. I did 'lsof /mnt' which only displayed a few processes, and did not pick up the idle network connections. 'lsof /dev' picked up all the stuff, without all the over kill of +D /directory. Might help if I follow directions a little more closely.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.