Managing USB device names

Giorgos Keramidas keramida at ceid.upatras.gr
Sat May 26 02:10:08 UTC 2007


On 2007-05-25 09:09, Chris Kottaridis <chriskot at quietwind.net> wrote:
> I am using USB to connect an external disk drive. It seems to get
> assigned a different device name when it connects in. The names seem to
> cycle through /dev/da* where * is changing on each disconnect and
> reconnect.
>
> With this going on I can't add a /etc/fstab entry.
>
> Is there a tool/package that can manage things so that when I plug in
> the device it will get mounted to a specific directory without manual
> intervention ?

GEOM_LABEL can help a lot here.

I have a USB stick which contains a UFS file system created with:

    # newfs -L GKER /dev/da0s1a

Now if geom_label.ko is loaded and this USB disk is attached, the
GEOM_LABEL support creates a special /dev node at `/dev/ufs/GKER':

: kobe kernel: umass0: <JetFlash Mass Storage Device, class 0/0, rev 2.00/1.41, addr 2> on uhub4
: kobe kernel: umass0: Get Max Lun not supported (STALLED)
: kobe root: Unknown USB device: vendor 0x058f product 0x6387 bus uhub4
: kobe kernel: da0 at umass-sim0 bus 0 target 0 lun 0
: kobe kernel: da0: <JetFlash TS1GJF150 8.07> Removable Direct Access SCSI-2 device
: kobe kernel: da0: 40.000MB/s transfers
: kobe kernel: da0: 979MB (2007038 512 byte sectors: 64H 32S/T 979C)
: kobe kernel: GEOM_LABEL: Label for provider da0s1a is ufs/GKER.

# ls -ld /dev/ufs/GKER
crw-r-----  1 root  operator  -   0, 176 May 26 04:31 /dev/ufs/GKER
#

The device node at `/dev/ufs/GKER' is directly mountable:

# mount -o ro /dev/ufs/GKER /mnt/flash
# mount | fgrep /mnt/flash
/dev/ufs/GKER on /mnt/flash (ufs, local, read-only)
#

Using GEOM_LABEL support and the geom_label.ko kernel module, you can
assign names to your filesystems which persist across mount operations,
so it will be easier to mount them at predictable places.

Regards,
Giorgos




More information about the freebsd-questions mailing list