Can’t eject cdrom? Try fuser

Just a quick note to myself (and anyone else who might be in a similar situation)…

Sometimes, after I’ve played some video file written on a cd-rom, I can’t eject it because the file is locked/used by another application/daemon (like dbus-launch or dbus-daemon).

The quicker way I’ve found to unlock/free the file (and eject the disc) is to use “fuser -k” with the full path specification of the file as an argument, like this:

fuser -k /cdrom/file.avi

If, on the other hand, you just want to see which processes are using a certain file, try these commands from any terminal:

fuser -v /var/spool/mail/$LOGNAME
lsof /var/spool/mail/$LOGNAME

Visit The Light of the LAMP blog for more…