ejecting reluctant CDs in Linux

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search

computing: software: Linux: ejecting reluctant CDs in Linux

Overview

Linux tends to lock CD and DVD drives, which prevents the drive from ejecting their media even if you press the drive's "eject" button.

Some useful commands for this situation – execute these as root or using sudo, where /dev/name is the name of the device name (this can be found using KDiskFree, but there are probably better ways):

  • This command forces the device to umount, even if busy (but it may not work even so):
umount -f /dev/name
  • lsof (might be in /usr/sbin) lists processes which have files open on the device, so you can kill them:
lsof /dev/name
  • This command kills processes that don't want to die (where pid is the process ID number):
kill -9 pid
  • And finally, if the drive seems completely unmounted but the door still won't open, try:
eject /dev/name

More Tips

If the door won't open but eject says it can't open the device, try attempting to mount the drive, then try manually ejecting again.