LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   any way to detect device is busy (https://www.linuxquestions.org/questions/linux-general-1/any-way-to-detect-device-is-busy-467893/)

jrfk2 07-26-2006 11:16 AM

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 ...

Matir 07-26-2006 11:59 AM

Try 'lsof | grep /media/cdrom'.

burninGpi 07-26-2006 01:09 PM

easier way: lsof /dev/hdc


All times are GMT -5. The time now is 08:21 PM.