Jump to content

TR-04: umount says: "device is busy"


Recommended Posts

Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [IM: Installing and Configuring Mandrake]

 

TR-04: umount says: "device is busy"

 

I can't unmount a partition even as root; the error message I get is "umount: partition_name: device is busy" what can I do?

 

Many times when you attempt to unmount a partition (removable or not) you encounter this kind of messages:

 

~# umount /mnt/win_c/
umount: /mnt/win_c: device is busy
~#

This happens because some processes are still accessing that partition while you are unmounting it.

 

Untill you close or kill those processes you won't be able to umount the partition.

Many times you just remember what you were doing there and you just close the app/s you were using and the problem is solved. But many other times it is not that easy (for example with NFS mounts) because you don't remember what is using that partition or because you don't know that information at all.

 

So to kill (or just to know) the processes that are accessing a given partition you can use any of the following commands:

  • /sbin/fuser

In order to solve our example problem, I can issue this command: fuser -km partition; and then all the proccesses accessing our problematic partition will be killed allowing me to unmount it:

~# fuser -km /mnt/win_c
/mnt/win_c:           3762
~# umount /mnt/win_c/
~#

And that's all, see the "references" section for further info on the topic.

 

PS: In case you just want to know which processes are accessing a given partition (instad of killing them) you can issue any of the following commands:

~# fuser -vm /mnt/win_c
                    USER        PID ACCESS COMMAND
/mnt/win_c           aru       10170 ..c..  bash
                     aru       10636 f....  vi

~# lsof /mnt/win_c
COMMAND   PID USER   FD   TYPE DEVICE  SIZE NODE NAME
bash    10170 aru   cwd    DIR    3,1 16384    1 /mnt/win_c
vi      10636 aru    4u    REG    3,1 12288 1119 /mnt/win_c/bioq/mcycle/.mcdate.cnf.swp

(In the above example I had a shell session opened at /mnt/win_c/ and in other xterm I was viewing with vi a file in that partition).

 

References:

 

man lsof

man fuser

Link to comment
Share on other sites

 Share

×
×
  • Create New...