usb umass flash drive mount/umount questions

Fred Clift fclift at verio.net
Tue Feb 3 07:59:18 PST 2004


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 at verio.net -- Remember: If brute
force doesn't work, you're just not using enough.


More information about the freebsd-questions mailing list