Eject Mounted Media
Note: this trick only applies to CD-ROM media
Normally the Linux kernel automatically locks the CD-ROM drive door/tray when a CD is mounted. This prevents removal of the disk until all processes finish accessing the media and the drive is unmounted. It is possible to tell the kernel to leave the drive lock mechanism alone allowing the user to eject a mounted CD at any point without any prior interaction with the system. Modern desktops like Gnome and KDE will perform a lazy unmount after a disc is removed in this way to keep the system state from getting confused.
To enable this functionality set /proc/sys/dev/cdrom/lock to 0:
echo 0 > /proc/sys/dev/cdrom/lock
You will have to put this line in a startup script like /etc/rc.d/rc.local if you want this functionality to persist across reboots, or if your system supports /etc/sysctl.conf then add the following line to that file:
dev.cdrom.lock = 0
This won’t prevent applications from locking the drive door themselves, so CD/DVD recording programs can still keep the user from ejecting the media while burning.