umass to /dev/da* mapping

Zane C. B-H. v.velox at
Wed Dec 7 10:49:08 UTC 2011

On Mon, 5 Dec 2011 17:08:15 +0000
Mike Clarke <jmc-freebsd2 at> wrote:

> I have a fairly simple perl script which is run by devd when I plug
> in a USB memory stick. The script sets up some permissions and a
> link to make life easy for a user to mount the memory stick.
> This normally works fine but there are problems if the memory stick
> is already inserted before booting.
> Normally my internal 4 slot memory card reader is detected as
> umass0 with devices da[0-3] and when the USB memory stick is
> inserted it comes up as umass1 with device da4 and my script works
> on that assumption. If the USB stick is present on booting then it
> appears as da0 on umass0 and the card reader is da[1-4] on umass1
> so the script fails.
> Is there any convenient way for my script to determine which da*
> devices correspond to the umass device name?

Why are you using a custom Perl script for this instead of the built
in tools for this?

Below is how I have it setup on my system...

In /etc/devfs.rules...

add path 'da*s*' mode 0660 group 5001

In /etc/rc.conf...


In /etc/sysctl.conf...


And what group 5001 is...

[kitsune at vixen42]/etc> getent group 5001
[kitsune at vixen42]/etc> 

Allows the group "devDAaccess" to access /dev/da*s* and mount it.

For more reading on this, I suggest the following man files...


More information about the freebsd-questions mailing list