LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-11-2006, 10:03 PM   #1
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
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.

Any methods/suggestions?

Thanks!
...drkstr
 
Old 09-11-2006, 10:10 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
try "lsof" on the file device in question, if you have that installed.
 
Old 09-11-2006, 10:46 PM   #3
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Original Poster
Rep: Reputation: 45
I do.

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.

Thanks again for the help!
...drkstr
 
Old 09-11-2006, 10:54 PM   #4
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
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.

Last edited by tuxdev; 09-11-2006 at 10:56 PM.
 
Old 09-12-2006, 08:25 AM   #5
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Original Poster
Rep: Reputation: 45
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.

Thank you my friend!
...drkstr
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unmounting busy images Boudewijn Linux - Newbie 16 09-24-2004 08:37 AM
Unmounting busy device AudunJohansen Linux - General 6 06-16-2004 10:48 AM
unmounting sda device jogurt666 Linux - Hardware 2 01-07-2004 12:29 PM
unmounting busy device burp Slackware 4 11-29-2002 05:54 AM
unmounting device while file is open gui10 Linux - Newbie 2 04-10-2002 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration