LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-26-2006, 11:16 AM   #1
jrfk2
LQ Newbie
 
Registered: Jan 2006
Posts: 24

Rep: Reputation: 0
any way to detect device is busy


Looking for a general way to detect if a device is busy.

Specifically my program was writing a large file to DVD and that was taking awhile and a problem somewhere else had me umount -vf the DVD and umount went bizarro on me.

Before I issued the umount -vf, /etc/mtab showed the cdrom as
/dev/hdc /media/cdrom

then these messages came out of umount:

umount2: device or resource busy
umount: /device/hdc: not mounted
umount2: device or resource busy
umount: /device/hdc: not mounted
could not umount /media/cdom - trying /dev/hdc instead

after all this, the entry for /media/cdrom is gone from /etc/mtab, but the DVD lite is still on and I can't eject the DVD and have to reboot to get it out.

I presume the -f option may have done some of this to me, but I need to keep that option there ...

So to try to prevent this whole scenerio, I want to check if the device is busy before I even try the umount -vf ...

Any suggestions out there ? thanks ...
 
Old 07-26-2006, 11:59 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Try 'lsof | grep /media/cdrom'.
 
Old 07-26-2006, 01:09 PM   #3
burninGpi
Member
 
Registered: Mar 2006
Location: Fort McMurray, Canada
Distribution: Gentoo ~amd64
Posts: 163

Rep: Reputation: 30
easier way: lsof /dev/hdc
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/: Device busy? ginda Linux - Newbie 4 02-02-2005 04:29 PM
Device is busy anamika123 Linux - General 6 09-19-2004 11:58 AM
Device is Busy...??? GrumpyGnome Linux - Software 2 07-01-2004 11:43 AM
Unmounting busy device AudunJohansen Linux - General 6 06-16-2004 10:48 AM
Device is busy juanb Linux - General 5 11-05-2003 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:19 PM.

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