umount device busy

Gary Aitken freebsd at dreamchaser.org
Mon Jun 4 02:28:35 UTC 2012


Combining several responses to save traffic; thanks all

>> 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.On 06/03/12 09:24, Polytropon wrote:
> 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
> here.

It's still valid.  I can cd there and look at anything in the subtree.

> 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).

may try that but will probably decide to use two different drives for removable backup, one for windoze and one for fbsd.

> if you are using xfce4, then you have most likely got gamin running as well, this caused the same problem for me when trying to umount an external USB drive

gamin *is* installed, and I did have the file browser up and using it to look at the ntfs disk.  I thought it might be holding a file open, so first I backed it out to something not on the ntfs disk, then exited it.  Made no difference.
Also, no gamin currently running.  But as Warren Block noted, it causes this problem, so I'm assuming that is it.

> I resolved my umount problem by including the -f switch
> 
> #umount -f /mnt/goflex

Which is what I am ending up doing.  

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

That's what I kept thinking.  Backed out of all su ops, checked all xterms; nada.
no other vtys opened.  In any case, the mount was done after X was started, and switching vtys crashes X so I don't do that.

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

Nice to know someone else admits to that too :-).  In this case, not the problem.

>> 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".
> 
> Yes, it does. :)

> 'readonly' means just that.  'readonly' NOT shown means read/write.

I thought maybe so, but didn't know for sure.  Thanks.
But Lars' "mount -p" is more assuring.

>> 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).

I thought maybe so, but then tried another test which should have had output and it didn't.  But that one was operator error.  Retried just now and got something so that's just being tired and not recognizing what I'm doing.  Thanks.

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

Otherwise -x thinks the /mnt/goflex belongs to it.

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

Thanks.  I get a 
  grops: can't open file `a4` but I'll deal with that later.

> man -t lsof | sp2ascii > savefile.txt

Where'd you get/find sp2ascii?  I don't see one anywhere, not even on google.
(Except this thread...)  Secret weapon?

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

It did.  I didn't say it didn't find lsof, just no faq :-)

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

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

hope not, but not a heck of a lot of choices at this point.  Since I didn't do squat because of the failed mkdir, seems hopeful.

> The specific complaint was concerning '.'  this indicates a filesystem
> error.  Note: it is (or, at least 'used to be') documented that _writing_
> to NTFS filesystems was likely to have problems.

> xfce uses gamin to scan for new files and directories, but it causes just this problem. Edit /usr/local/etc/gamin/gaminrc and set it to poll the device directory:
> 
> poll /mnt/*

I've mounted them ro a number of times, but never tried writing before.
Twice warned (or was it three times?).  Permanently shy.
Many thanks, all.

> 
> something that *might* be helpful to you, it's a basic little man page
> browser in Qt
> left side of the pane shows a treeview of filesystem, so you can navigate
> /bin, /usr/bin, etc.. when you click on a file it looks for the
> corresponding man page and shows it on the right pane formatted html, which
> is a webkit panel.
> 
> https://github.com/creamy/man-browser
> 
> it is intended as a way to quickly look at what's installed on your system
> and possibly 'discover' and learn about previously 'unknown' commands.

Thanks.

Gary










More information about the freebsd-questions mailing list