removable devices auto umounting

Da Rock rock_on_the_web at
Thu Mar 20 16:42:20 PDT 2008

On Thu, 2008-03-20 at 14:14 +0100, Roland Smith wrote:
> On Thu, Mar 20, 2008 at 09:55:37PM +1000, Da Rock wrote:
> > > > I'm just looking into the removable device issue for freebsd. I can see
> > > > its easy enough to auto mount a removable device (although I could use
> > > > some help getting sd/xd devices working with my card reader), but the
> > > > removal seems to come unstuck.
> > > > 
> > > > I have some barely literates on my systems, so I do need to work this
> > > > out. Is it possible to use a forced umount to do this? What are the
> > > > options here?
> In all honesty, I'm not sure FreeBSD (or any other OS, for that matter)
> is suitable for 'barely literates'. A computer is not a toaster.

True enough. But at least they know how to plug in and unplug a device-
I just don't know if they'll remember to umount first!

> <snip>
> > > One (not bullet-proof) workaround might be to use the automounter
> > > [amd(8)], and have it unmount very quickly after they stop being
> > > active. This requires setting both the 'cache_duration' and
> > > 'dismount_interval' options in amd.conf(5) to very low values.
> > 
> > So by active you mean device access? 
> I mean access to the auto-mounted directory, or files therein.

That'd be perfect then.

> > Or device physical connection? If
> > its simply access, than that would be perfect- user enters the mount
> > point, 
> User needs to plug in the device first!
> And it is actually worse. Depending on if and how the usb device was set
> up, you need to use the device daX[sY], where X depends on how many other
> da devices are already in use, and the optional Y depends on how it was
> sliced (partitioned in DOS parlance). 
> Furthermore, you need to know which kind of filesystem is used. Most
> thumbdrives are msdosfs, but larger ones might be ntfs as well.
> For msdosfs, I use: 
> 'mount_msdosfs -m 644 -M 755 -o noatime -o sync -o noexec -o nosuid $DEV $DIR'

I'm sure I could script something to get around that. That shouldn't be
too hard, but I take your point: I need to consider nearly all

> > Also, what docs/how-to's would you suggest for AMD? I looked at the man
> > and some freebsd doc pages, but another viewpoint would help.
> > Specifically some more docs on the settings you mention.
> I've never used amd, so I can't help you there. :-)
> > Bullet-proof is not exactly necessary- nice, but not critical.
> > Suggestions for bullet-proof are very welcome though. What is the worst
> > that can happen if dismounting is not entirely successful? Keeping in
> > mind that this is mostly a desktop system.
> Last time I tried unplugging a USB device before unmounting it I got a
> kernel panic.
> Roland

That last point would only occur if the device was still being written
to- right? I'm sure my users can be trained at least that far... I will
watch out for that though.

Thanks for the input. I reckon I can get it working (relatively)
smoothly now.

Don't suppose you know anything about setting up internal card readers
in laptops at all? Trouble is I don't think it's hooked up to the usb
bus. Its a Texas Instruments model.

More information about the freebsd-questions mailing list