umount device busy

Lars Eighner luvbeastie at larseighner.com
Sun Jun 3 15:55:39 UTC 2012


On Sun, 3 Jun 2012, Gary Aitken wrote:

> Something I'm overlooking here and a lot of questions I can't seem to find
> the answers to...
>
> I mounted a usb drive
>  mount -t ntfs /dev/da0s1 /mnt/goflex
>
> Then, as nearly as I can remember...
>  I then poked around a bit using the xfce4 browser.
>  I tried to mkdir from the mount point as a normal user:
>    cd /mnt/goflex
>    %mkdir breakaway
>    mkdir: .: No such file or directory
>  After checking write premissions, which I didn't have,
>  I did an su -l and tried again, with the same results.
>
> I then tried to unmount the drive, believing it was mounted read-only:
>    #umount /mnt/goflex
>    umount: unmount of /mnt/goflex failed: Device busy

This almost always means someone (i.e. you) is sitting in the directory.
If you tried this while su'ed and the un-su'ed you were still in the
directory /mnt/goflex, you'd get this message.  This may also happen if
someone (i.e. you) is in the directory on another vtty.  Naturally it can
also mean some operation is in progress, but generally you would have
recognized and avoided that.

> As nearly as I can tell, I don't have anything pointing at that drive.

As I said, were you in the directory when you su'd?  If so, you need to drop
back and get out before you su again an umount.


> Questions:
>
> 1.  What does the "No such file or directory" mean from mkdir?
>    It's a relative dir name, and I'm sitting at a valid dir.

You did not provide a history with this problem, but generally it means some
part of the path before the last does not exist.  I get it for using a
leading /, when I meant a relative path, or not using the leading slash when
I meant an absolute path -- and of course for misspelling some part of the
path.


>
> 2.  How do I find out how the file-system was mounted?
>    mount (noargs) does not show read/write status

Did you try

$mount -p

?


>
> 3.  I tried lsof but I don't get any output from it:
>      lsof +d /mnt/goflex -x -- /mnt/goflex
>    Where does it go if not to stdout?

You've got me! But why is there anything after -x?  I don't quite
understand.

>
> 4.  lsof has a *long* man page, so I'd like to save it temporarily so I
> can search it in an editor.  If I do man lsof >temp.tmp the output
> contains backspace sequences which screw up searching.  How do I get man
> to produce plain text without the control sequences?

man -t lsof | sp2ascii > savefile.txt


>
> 5.  The lsof man page references a faq which is supposed to be part of the
> distribution.
>    find . -ls | grep lsof doesn't show any faq.

I can't find it either, but I don't know why the above did not show
/usr/local/share/lsof .  /usr/local/share is where to look for such things,
and /usr/local/share/doc is generally where any docs that are install are
/  found.


>
> 6.  And finally, any idea why umount says the device is busy?

Answered above.  When you su, where you may go while su'd has no effect on
where you left yourself.  You (as a normal user) are still on the mounted
directory so the mounted device is busy. You have to drop back (exit su)
and move out of the device before you can umount it.

>
> Seems like I should have been able to find the answer to at least one of those but I'm coming up short.
>
> Thanks for relevant pointers,


-- 
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266



More information about the freebsd-questions mailing list