Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've mounted a block device (internal hard disk) to say ~/HD, and I'm trying,

~# umount ~/HD

It answers,

umount: device is busy.

Now I kill all processes manually by examining

~# fuser -m ~/HD

I also make sure that really no process is accessing the ~/HD path

~# lsof | grep HD

Still umount ~/HD says device is busy even with -f option.

PS: I don't want to use the -l option of umount, since the mounted device is actually an encrypted mapper device, which in turn won't get unmounted unless mapper device is clearly unmounted.

So basically my question is how to really force umount to unmount a device OR How can a device still be marked as busy while no processes are accessing it (or at least fuser and lsof don't report it) and what can I do about it?

I'm on Ubuntu 9.10 x64.

share|improve this question

migrated from stackoverflow.com Dec 14 '09 at 12:19

This question came from our site for professional and enthusiast programmers.

    
Related: superuser.com/questions/73028 –  Ilari Kajaste Dec 14 '09 at 15:19
add comment

7 Answers

up vote 3 down vote accepted

You will see this behavior if you have mounted something else on a subdirectory of ~/hd. In this case, neither fuser nor lsof will show anything. If you haven't mounted anything under ~/hd ('mount' will answer this question), then I'm not sure what to check.

share|improve this answer
    
I'm selecting your answer as best one, even this wasn't my condition but it may help others. Also, can't find any better answer. ;) –  Vikrant Chaudhary Jan 27 '10 at 11:38
add comment

Make sure your current working directory (run 'pwd') is not a under ~/hd. If you are currently in that directory, umount will refuse to unmount.

share|improve this answer
add comment

Command lsof will tell you what process(es) hold a file open.

share|improve this answer
add comment

to locate active processes/users execute:

fuser -u /path/to/mount

then execute the following to remove them:

fuser -k /path/to/mount

finally umount the offending device.

share|improve this answer
add comment

Larsks wrote: "You will see this behavior if you have mounted something else on a subdirectory of ~/hd. In this case, neither fuser nor lsof will show anything."

Using lsof with grep will show subdirectory use - eg "lsof |grep HD".

I had the same problem as the original poster and found the cause using the command above.

share|improve this answer
add comment

Have you tried to use sync?

The sync command flush the filesystem caches by force the changed blocks to be writed on the disk.

share|improve this answer
    
There is no need to sync -- umount will flush the cache as needed. –  Kevin Panko Dec 15 '09 at 18:10
add comment

If you really want to just unmount it, you can use umount -f

from man umount :

-f     Force unmount (in case of an unreachable NFS system).  (Requires kernel 2.1.116 or later.)
share|improve this answer
add comment

Your Answer

 
discard

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.