Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 2004 08:59:16 -0700
From:      Fred Clift <fclift@verio.net>
To:        freebsd-questions@freebsd.org
Subject:   usb umass flash drive mount/umount questions
Message-ID:  <20040203084956.O91207@irfcn.qzm.berz.irevb.arg>

next in thread | raw e-mail | index | archive | help

Ok - I've got a lexar 64Mb flash drive - aka 'thumb' drive.  I've modified
my usbd.conf to automatically mount the device on insertion.  I have a
single slice and a single FreeBSD partition with a ufs filesystem on it.


I am wondering if there is any way I can have the device unmounted
automagiclaly on removal - it seems that by the time the OS gets a message
about the usb device detaching, that it is to late to flush pending writes
to the device since the device is already gone.

So, are there other fstypes, or some kind of filesystem tuning or mount
flags I can use to say "always flush all writes synchronously" so that if
the device disappeared it would be consistent and have the right contents.
And, on top of that, is there some way that I can convince the OS to not
barf when trying to unmount a device that has already gone?    Or can I
hook the usb code to somehow do an umount before the daX device goes away?

I _think_ that a dos filesystem might meet the first requirement, but how
can I do the second?  Even then, I'd rather not have to use a dos
filesystem since it limits possible filenames.  This still doesn't take
care of unmounting the device properly at removal.  I know there are
packages like mtools that just use the device file and never actually
mount the device -- this isn't really acceptable either...

For now, I have a ufs filesystem, I automatically mount on insertion and I
manually have to unmount.  Anything better to be doing?

Fred

--
Fred Clift - fclift@verio.net -- Remember: If brute
force doesn't work, you're just not using enough.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040203084956.O91207>