Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Apr 2005 22:01:14 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        freebsd-questions@freebsd.org
Cc:        Todd Shirk <ts4short@gmail.com>
Subject:   Re: automount usb flash drive?
Message-ID:  <20050406200114.GA64643@slackbox.xs4all.nl>
In-Reply-To: <4878093805040612323d984eb0@mail.gmail.com>
References:  <4878093805040612323d984eb0@mail.gmail.com>

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

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Apr 06, 2005 at 03:32:14PM -0400, Todd Shirk wrote:
> I was trying to figure out how to have a usb flash drive automount
> when I plug it in.  I currently have the following line in /etc/fstab
>=20
> /dev/da0s1  /mnt/usbkey  msdos  rw,-m700,noauto  0  0
>=20
> and the following in /etc/devfs.conf
>=20
> perm  da0s1  0666

devfs.conf only works for devices available at boot time. For devices
you can plug in at runtime you should use /etc/devfs.rules:

[foobar=3D10]
add path 'da*s*' mode 0666

And you should have the following in /etc/rc.conf:

devfs_system_ruleset=3D"foobar"

The contents of devfs.rules are fed to devfs(8), so see it's manual page.

> when I do the following command line command the usb flash drive mount fi=
ne
>=20
> # mount /mnt/usbkey
>=20
> But, when I'm in KDE viewing media:/  Removable Device (da0s1) is
> shown is unmounted.
>=20
> At the user level command line and in KDE, I receive /dev/da0s1:
> Operation not permitted.

For a user to be able to use a filesystem, there are a couple of things
that need to be done:
- The sysctl variable vfs.usermount must be set to 1 (in /etc/sysctl.conf).
- The user in question must own the mount point.

> I'm not sure if part of the issue is permissions or if I'm missing a
> piece for the auto-mounting to happen.

I think the latter. Normally usbd(8) is notified of USB events, but in
this case it seems to get events for the umass* device, not the da*s*
device that you'll want to use. There have been people who've used a
shell-script called by usbd to figure out the connection between
umass<->da from dmesg output and then mount the filesystem, but that
doesn't do umounts. It's also complicated if you want it to work for
multiple users, unless you give it 777 permissions. You could also give
amd(8) a try.

I found that making a one-line shell script to do the mounting is much
less hassle.

Roland
--=20
R.F. Smith                           /"\    ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in e-mail
http://www.xs4all.nl/~rsmith/         X     No Word docs in e-mail
public key: http://www.keyserver.net / \    Respect for open standards

--HlL+5n6rz5pIUxbD
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQFCVEAKEnfvsMMhpyURAry9AJ9k65BXKTHKDJQmUKmY1Jw/ETOLoACgsR9R
fvr183T7neNLH+fn3c6q9m4=
=xw+u
-----END PGP SIGNATURE-----

--HlL+5n6rz5pIUxbD--



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