It is very annoying when Linux doesn’t allow you to unmount a CD or a USB flash disk saying “Device is busy”. In such cases, Linux doesn’t let you take out the CD by ejecting the drive. This typically happens when files in sub-directories or the directory in which the CD or the flash drive is mounted. For example, if your CD is mounted in “/mnt/cdrom” directory and you have some active applications that have opened files present in /mnt/cdrom or in any of its sub directories. Linux will not allow you to unmount the drive unless all those applications are closed. If you are not sure about the mount point of your device, run the ‘mount‘ command at the terminal.

The following can be some of the reasons.

  • You have opened a shell with one of the directories of mount point as current directory. In such case, you can use ‘pwd‘ command at shell to find out if current directory is falling under the mount point (/mnt/cdrom in this example). If so, just move out of mount point.
  • You have application like editor or konqueror using the files under the mount point. However this is sometimes not easy to identify.as application may have files open under mount point in the background. It depends on the implementation of the application and can not be generalized.

In any case, if you are unsure which application is currently using the files under mount point, you can use fuser command to find the list of processes.

The following example identifies all the processes which are attached to the directory /mnt/cdrom ot any of its sub directories. Here I have a bash terminal session which has /mnt/cdrom as current directory.

[root@techpulp ~]# umount /mnt/cdrom
umount: /mnt/cdrom: device is busy
umount: /mnt/cdrom: device is busy
[root@techpulp ~]# fuser -f /mnt/cdrom
/mnt/cdrom:                   3278c
[root@techpulp ~]# ps -e | grep 3278
3278 pts/5    00:00:00 bash
[root@techpulp ~]# kill -9 3278
[root@techpulp ~]# umount /mnt/cdrom
[root@techpulp ~]#