• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[Gelöst] udev: Keine Seriennummer für Festplatte

gehrke

Administrator
Teammitglied
Moin *

Ich würde gerne udev nutzen, um $Dinge zu triggern, sobald eine bestimmte Festplatte angestöpselt wird. Hierzu wollte ich das eindeutige Merkmal Seriennummer verwenden, aber leider finde ich das gar nicht im Output von udevadm:
Code:
# udevadm info  --query=all --attribute-walk --name=/dev/sdb

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:12.0/ata2/host1/target1:0:0/1:0:0:0/block/sdb':
    KERNEL=="sdb"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{alignment_offset}=="0"
    ATTR{capability}=="50"
    ATTR{discard_alignment}=="0"
    ATTR{events}==""
    ATTR{events_async}==""
    ATTR{events_poll_msecs}=="-1"
    ATTR{ext_range}=="256"
    ATTR{hidden}=="0"
    ATTR{inflight}=="       0        0"
    ATTR{range}=="16"
    ATTR{removable}=="0"
    ATTR{ro}=="0"
    ATTR{size}=="15628053168"
    ATTR{stat}=="    6384      400    59344   212533   384763    21671 548717048 15070027        0   408976 15086735        0        0        0        0"

  looking at parent device '/devices/pci0000:00/0000:00:12.0/ata2/host1/target1:0:0/1:0:0:0':
    KERNELS=="1:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{blacklist}==""
    ATTRS{device_blocked}=="0"
    ATTRS{device_busy}=="0"
    ATTRS{dh_state}=="detached"
    ATTRS{eh_timeout}=="10"
    ATTRS{evt_capacity_change_reported}=="0"
    ATTRS{evt_inquiry_change_reported}=="0"
    ATTRS{evt_lun_change_reported}=="0"
    ATTRS{evt_media_change}=="0"
    ATTRS{evt_mode_parameter_change_reported}=="0"
    ATTRS{evt_soft_threshold_reached}=="0"
    ATTRS{inquiry}==""
    ATTRS{iocounterbits}=="32"
    ATTRS{iodone_cnt}=="0x61a60"
    ATTRS{ioerr_cnt}=="0x2b8"
    ATTRS{iorequest_cnt}=="0x620cb"
    ATTRS{model}=="HGST HUH728080AL"
    ATTRS{ncq_prio_enable}=="0"
    ATTRS{queue_depth}=="32"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{queue_type}=="simple"
    ATTRS{rev}=="T7J0"
    ATTRS{scsi_level}=="6"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{type}=="0"
    ATTRS{unpriv_sgio}=="0"
    ATTRS{vendor}=="ATA     "
    ATTRS{vpd_pg0}==""
    ATTRS{vpd_pg80}==""
    ATTRS{vpd_pg83}==""
    ATTRS{vpd_pg89}==""
    ATTRS{wwid}=="t10.ATA     HGST HUH728080ALE600                    VKH1994X            "

  looking at parent device '/devices/pci0000:00/0000:00:12.0/ata2/host1/target1:0:0':
    KERNELS=="target1:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:12.0/ata2/host1':
    KERNELS=="host1"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

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

  looking at parent device '/devices/pci0000:00/0000:00:12.0':
    KERNELS=="0000:00:12.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ahci"
    ATTRS{ari_enabled}=="0"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x010601"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x31e3"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{index}=="1"
    ATTRS{irq}=="126"
    ATTRS{label}=="Onboard - SATA"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{local_cpus}=="f"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{revision}=="0x03"
    ATTRS{subsystem_device}=="0x7270"
    ATTRS{subsystem_vendor}=="0x8086"
    ATTRS{vendor}=="0x8086"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
Erwartet hatte ich einen Eintrag wie:
Code:
    ATTRS{serial}=="1234567890"
Was übersehe ich?
TNX

Glückauf,
gehrke
 
Meines Wissens hat SATA kein Attribute serial aber sehr wohl das Property
Code:
# udevadm info --query=property --name=/dev/sdb
Ausprobieren.
Das Property sollte in den rules mit der id ID_SERIAL (oder so ähnlich) erreichbar sein.
z.B. ENV{ID_SERIAL}=="blah_blah"

Gruß
Gräfin Klara
 
OP
gehrke

gehrke

Administrator
Teammitglied
Korrekte Antwort. ID_SERIAL als Property sieht sehr nach einer eindeutigen Seriennummer aus.

Großartig - vielen Dank!
 
Oben