You are not logged in.

#1 2010-05-31 16:04:36

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

mounting USB harddrives via UDEV with uuid?

I started using arch with Gnome as primary system, there was this 'built in' automount via uid.
now that i've changed to openbox, which program is the most prefered for openbox?
Could it be that having udev and some other mount-programs on my local installation causes problems?
And: Wasn't there something like almost all major distris started to use udev? Is this the better way to go when automounting?

Last edited by gpunkt (2010-06-01 15:06:07)

Offline

#2 2010-05-31 16:50:49

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: mounting USB harddrives via UDEV with uuid?

Offline

#3 2010-05-31 17:00:06

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: mounting USB harddrives via UDEV with uuid?

You can use a file manager like nautilus or pcmanfm in connection with hal for automounting.
personally, i use udev, too.


no place like /home
github

Offline

#4 2010-05-31 17:48:07

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

Re: mounting USB harddrives via UDEV with uuid?

I'd like to use something which isn't nautilus or pcmanfm (although pcmanfm looks great!) because i use a different filebrowser (but considering using pcmanfm.. dont knwo where i'll end up, atm i'm using something else and MC)
i'll try setting up udev and report back.

Offline

#5 2010-05-31 20:55:52

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

Re: mounting USB harddrives via UDEV with uuid?

so if i'd take this rule:

KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"

# Get label
PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# use basename to correctly handle labels such as ../mnt/foo
PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"
ENV{dir_name}=="", ENV{dir_name}="usbhd-%k"

ACTION=="add", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pmount %N %E{dir_name}'"
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pumount /media/%E{dir_name}'"
LABEL="media_by_label_auto_mount_end"

what do i have to change to make the rule let blkid read the uuid and not the label and mount it by uuid and not by label?

Offline

#6 2010-06-01 07:56:32

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

Re: mounting USB harddrives via UDEV with uuid?

blkid output:
/dev/sdc1: UUID="1474ba8c-a665-4065-8c1f-890aa79304ea" TYPE="xfs"
[root@archlinux nils]# udevadm info -a -p $(udevadm info -q path -n /dev/sdc1);                                                                                                    blkinfo > info

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4/1-3.4:1.0/h                                                                                                   ost11/target11:0:0/11:0:0:0/block/sdc/sdc1':
    KERNEL=="sdc1"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{partition}=="1"
    ATTR{start}=="63"
    ATTR{size}=="390716802"
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="4294935040"
    ATTR{stat}=="      37       72      290      120        0        0        0                                                                                                           0        0      120      120"
    ATTR{inflight}=="       0        0"

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4/1-3.                                                                                                   4:1.0/host11/target11:0:0/11:0:0:0/block/sdc':
    KERNELS=="sdc"
    SUBSYSTEMS=="block"
    DRIVERS==""
    ATTRS{range}=="16"
    ATTRS{ext_range}=="256"
    ATTRS{removable}=="0"
    ATTRS{ro}=="0"
    ATTRS{size}=="390721968"
    ATTRS{alignment_offset}=="0"
    ATTRS{discard_alignment}=="0"
    ATTRS{capability}=="52"
    ATTRS{stat}=="      54       75      450      266        0        0        0                                                                                                           0        0      266      266"
    ATTRS{inflight}=="       0        0"

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4/1-3.                                                                                                   4:1.0/host11/target11:0:0/11:0:0:0':
    KERNELS=="11:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{device_blocked}=="0"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="0"
    ATTRS{vendor}=="WDC WD20"
    ATTRS{model}=="00BB-98GUC0     "
    ATTRS{rev}=="0811"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{iocounterbits}=="32"
    ATTRS{iorequest_cnt}=="0x48"
    ATTRS{iodone_cnt}=="0x48"
    ATTRS{ioerr_cnt}=="0x4"
    ATTRS{modalias}=="scsi:t-0x00"
    ATTRS{evt_media_change}=="0"
    ATTRS{queue_depth}=="1"
    ATTRS{queue_type}=="none"
    ATTRS{max_sectors}=="64"

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4/1-3.                                                                                                   4:1.0/host11/target11:0:0':
    KERNELS=="target11:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4/1-3.                                                                                                   4:1.0/host11':
    KERNELS=="host11"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4/1-3.                                                                                                   4:1.0':
    KERNELS=="1-3.4:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb-storage"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{bInterfaceClass}=="08"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bInterfaceProtocol}=="50"
    ATTRS{modalias}=="usb:v05E3p0702d0033dc00dsc00dp00ic08isc06ip50"
    ATTRS{supports_autosuspend}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3/1-3.4':
    KERNELS=="1-3.4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="c0"
    ATTRS{bMaxPower}==" 96mA"
    ATTRS{urbnum}=="238"
    ATTRS{idVendor}=="05e3"
    ATTRS{idProduct}=="0702"
    ATTRS{bcdDevice}=="0033"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="6"
    ATTRS{devpath}=="3.4"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{product}=="USB TO IDE"

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-3':
    KERNELS=="1-3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{urbnum}=="99"
    ATTRS{idVendor}=="0409"
    ATTRS{idProduct}=="005a"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="3"
    ATTRS{devpath}=="3"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="4"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="142"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0002"
    ATTRS{bcdDevice}=="0206"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="6"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.33-ARCH ehci_hcd"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{serial}=="0000:00:02.1"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:02.1':
    KERNELS=="0000:00:02.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci_hcd"
    ATTRS{vendor}=="0x10de"
    ATTRS{device}=="0x077c"
    ATTRS{subsystem_vendor}=="0x1019"
    ATTRS{subsystem_device}=="0x1b67"
    ATTRS{class}=="0x0c0320"
    ATTRS{irq}=="21"
    ATTRS{local_cpus}=="ffff"
    ATTRS{local_cpulist}=="0-15"
    ATTRS{modalias}=="pci:v000010DEd0000077Csv00001019sd00001B67bc0Csc03i20"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    ATTRS{companion}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Offline

#7 2010-06-01 15:05:12

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

Re: mounting USB harddrives via UDEV with uuid?

*push* writting udev rules doesnt't seem that hard, but i don't understand it when it comes to uuid, everything i find when i search online is either out of date or uses NOT uuid. And there's no example set nowhere where i could look how this is done normaly.

Offline

#8 2010-06-02 04:02:48

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

Re: mounting USB harddrives via UDEV with uuid?

push

Offline

#9 2010-06-02 05:26:37

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: mounting USB harddrives via UDEV with uuid?

The udev rule you yourself linked uses blkid to get a variety of environment variables tacked onto the device, one of which is the UUID. Perhaps if you looked at the output of 'blkid' and 'udevadm info' against the devices in question you'd  see how it works.

Offline

#10 2010-06-02 11:25:30

gpunkt
Member
From: terminated.
Registered: 2010-05-17
Posts: 54

Re: mounting USB harddrives via UDEV with uuid?

I've just tried and searched to long the last days. I'm giving it a new try.
So with blkid i get something very long as the uuid, but with udevadm info ATTRS{serial} is not available or very short.. whats the difference?

Last edited by gpunkt (2010-06-02 11:25:48)

Offline

#11 2010-06-02 16:18:53

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: mounting USB harddrives via UDEV with uuid?

UUIDs are generated by the filesystem itself. If you're seeing a shorter UUID than what you're expecting, it's valid, it's just not generated by a linux filesystem. Use the variable "ID_FS_UUID" (generated by the blkid import)

Offline

Board footer

Powered by FluxBB