umass to /dev/da* mapping

Rod Person rodperson at rodperson.com
Wed Dec 7 16:22:00 UTC 2011


On Wed, 7 Dec 2011 16:07:09 +0000
Mike Clarke <jmc-freebsd2 at milibyte.co.uk> wrote:

> On Wednesday 07 December 2011, Zane C. B-H. wrote:
> 
> > On Wed, 7 Dec 2011 08:39:30 -0700 (MST)
> >
> > Warren Block <wblock at wonkity.com> wrote:
> > > On Wed, 7 Dec 2011, Zane C. B-H. wrote:
> > > > Still you will want to investigate what I've mentioned. It will
> > > > drastically simplify permission stuff as well as make automatic.
> > > > The devfs stuff is just not boottime only, but will be applied
> > > > to any new device added etc post boot.
> > >
> > > Are you sure of that?  Seems like devfs permissions are only
> > > applied when devfs(8) apply/applyset commands are run, directly or
> > > through /etc/rc.d/devfs.
> >
> > Yeah, I am sure of that. It is what I have setup here.
> >
> > /etc/devfs.conf - This one only affects boot time stuff.
> >
> > /dec/devfs.rules - This one contains the rules will be applied
> > during and post boot. It will also require you to specify which to
> > use in "/etc/rc.conf" as this file can contain multiple rule sets.
> 
> But can I use that to dynamically set up my link to the new device
> when the memory stick is inserted?
> 

Use devd.conf to do that. This is what I do.

#Mount and usb device that is plugged in and creates a da device
notify 20{
        match "system"          "DEVFS";
        match "type"            "CREATE";
        match "cdev"            "da[0-9]*";
        action "/usr/local/etc/rc.d/usb_device_action mount
        '/dev/$cdev'"; };

notify 20{
        match "system"          "DEVFS";
        match "type"            "DESTROY";
        match "cdev"            "da[0-9]*";
        action "/usr/local/etc/rc.d/usb_device_action umount
'/dev/$cdev'"; };

The action line is what you want it to do, in my case I have this
script I wrote that reads the device label, if it finds the label the
it will create a mount point with that label name, If it can't find a
label it creates a mount point using the device name.

-- 

Rod Person  http://www.rodperson.com  rodperson at rodperson.com

"Silence is a fence around wisdom"


More information about the freebsd-questions mailing list