device is busy...really?

Today, I was trying to figure out how I can run DVD Shrink on my Ubuntu. At some point, a DVD was stuck in my DVD-ROM drive and eject button would not work.

I tried to unmount the drive:
  • umount /dev/hdd (or umount /media/cdrom0)
but it failed with a message "device is busy". This means that some process/application is using the device but I could not locate it. I was getting really annoyed when I found out that
  • umount -l /media/cdrom0
would actually work.
Apparently, the -l unlinks /media/cdrom0 from fstab, at which point any apps
with a lock on this directory cannot access it anymore and therefore it can be successfully unmounted.

I did not think of this at the time but next time it happens, I'll try using lsof to locate the process:
  • lsof |grep /media/cdrom0
Post a Comment