Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes, I would like to umount a usb device, but I get a drive is busy error.

How do I find out which processes or programs are accessing the device?

share|improve this question
up vote 22 down vote accepted

Use lsof | grep /media/whatever to find out what is using the mount.

Also, consider umount -l (lazy umount) to prevent new processes from using the drive while you clean up.

share|improve this answer
fuser -mv /path/to/mountpoint might be a more readable alternative for finding out processes using a mointpoint. – Riccardo Murri Oct 14 '10 at 17:59

Most of the time, the best command to use is lsof (“list open files”).

lsof +f -- /media/usb0

where /media/usb0 is the mount point of the USB drive or other filesystem to unmount. +f -- tells lsof to treat the subsequent argument as a mount point; it usually, but not always, manages on its own, so that lsof /media/usb0 also works. This finds open files (even unlinked ones), memory mapped files, current directories, and some more obscure uses. You'll need to run the command as root to get information on other users' processes (and I think there are unices where lsof has to be run as root).

There are uses that lsof will not find; these are uncommon on removable media. They include:

  • mount points: you can't unmount /foo if /foo/bar is a mount point.
  • mount devices: you can't unmount /foo if /foo/bar is a mounted block device or loop-mounted regular file, or if it is the source of a Linux bind mount.
  • NFS export: lsof won't detect that a tree is exported by a kernel NFS server.

Another command that can serve in a pinch is fuser, which only lists PIDs of processes with open files on the device:

fuser -m /media/usb0
share|improve this answer

You can use lsof like Peter said, or if you're sure you just wanna kill all those things and unmount it, you can probably do something like:

fuser -k /mnt/path
umount /mnt/path
share|improve this answer

If you use GNOME, unmounting via Nautilus will display a message stating which process is still using the drive, and the file it's using.

alt text

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.