removable devices auto umounting

Roland Smith rsmith at
Thu Mar 20 06:14:56 PDT 2008

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.

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

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

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

[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list