Ejecting non responding drives in Linux

One of the biggest (not necessarily) problems that most (new) Linux users face is the problems of non responsive drives, espically when u insert a curropt CD / DVD which refuse to come out because something is trying to access it… or the extremely slow flash drives there are some software for it in windows like Unlocker ( dont remmember the correct name scine i dont use it ) but here we dont need any specific software we have had that feature from a long time and well its as simple as 2-3 lines on terminal and its name is ” fuser ” which is basicly used to displays the PIDs of processes using the specified files or file systems. and we can easily use it for our perpose, lets take an example suppose we need to remove the non responsing CD, for that you need to be root, do

su -


sudo -i

then type

fuser -k /dev/sr0


fuser -k /dev/cdrom0

which will kill all the process accessing that particular device, now you can easily eject the by doing

eject /dev/sr0


eject /dev/cdrom0

and you are done.

PS - ” fuser ” is useful in many more ways then just ejecting drives see ” man fuser ” for more info

Published: December 09 2008

  • category:
  • tags:
blog comments powered by Disqus