All well & good, &
eject is a good cmd. to know;
but we are not addressing the fact that you can't eject a device if it's busy, even root may not be able to u(n)mount it. Even:
Code:
# umount -f /mnt/cdrom
doesn't work. (The "#" is the root prompt.)
The real Q is: HTF are we supposed to figure out which is the "offending" app. when
umount refuses to work & gives a less-than-helpful "device is busy" msg.? Here are some code suggestions:
Code:
DEV=<device_you_are_trying_to_eject>
kill `lsof | grep $DEV | awk '{print $2}'`
This works for me, on my cdrom, w/ 2 instances on Konqueror open displaying its contents. I did not test it further. YMMV.
It would be nice if
umount had an option to list the apps./open files that are blocking the command. It would be even nicer if
umount had an option to close apps./open files & "just do it".
It would be nice if
eject had a force option that would incorporate the above.
We shouldn't be having to have this discussion.