umount device busy

Polytropon freebsd at
Sun Jun 3 15:24:28 UTC 2012

On Sun, 03 Jun 2012 08:59:11 -0600, 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
> As nearly as I can tell, I don't have anything pointing at that drive.
> 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.

I think I remember having read about problems with "Windows"-based
file system use, such as valid directories becoming invalid. The
error message you mentioned states /mnt/goflex is not a valid
directory (anymore), that's why no directory entry can be created

Consider NTFS being part of the problem, i. e. problems with the
_ntfs file system driver provided by the OS (as it seems you're
not using FUSE tools here - there are "fusefs-ntfs" and "ntfsprogs"
in the ports collection which may provide a functionality the
base system is missing here).

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

It does - implicitely. For -o ro, it shows "read-only".

> 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?

If no output redirection is applied, consider the output being
empty, as no error message is displayed (so both stdout and stderr
are silent).

> 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?

You can use less's search (key "/") when using the "man lsof"
command. You can also use a PDF viewer (including text search
functionality) so you can keep the formatting details.

The following command does the trick:

zcat `man -w lsof` | groff -Tps -dpaper=a4 -P-pa4 -mandoc | ps2pdf - /tmp/man_1_lsof.pdf

To convert to pure text, use -Tascii or -Tlatin1; however, this
renders to pure text without keeping the formatting intact.

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

Maybe there are writes pending, or it's just "held open" by Xfce.
Make sure no terminal session has the mount point as current
working directory, which would imply "device busy", even if
there's no actual reading or writing action.

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

You could use "umount -f" to force it, but that may result in
files missing.

Anyway, I've never actually used NTFS with FreeBSD so this could
also be a source of the problem.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list