[Eisfair] [e1] udev sichere Zuordnung

Detlef Paschke schabau at t-online.de
Fr Jun 8 12:36:30 CEST 2018


Hallo an alle,

ich habe wieder mal eine etwas umständliche Fragestellung zu udev.
Kurz gesagt ist gewollt, dass eine in einen Wechselrahmen geschobene
Festplatte immer auf den identischen Platz gemountet wird. Die
Identifikation soll aber nicht anhand der Festplatte selbst sondern
anhand des Wechselrahmens (der allein an einem eigenen Controller
steckt) erfolgen.

Die Platte ist (derzeit) sdg aber es sind noch mehrere scsi-Platten
ebenfalls in Wechselrahmen "davor" und da kann es durchaus vorkommen,
dass mal eine nicht vorhanden ist und schon würde sich alles verschieben.

Ich überlege, als Identifikation für den Steckplatz den Vendor des
Controller zu nehmen, da Modell oder ähnliches nicht angegeben sind.
Wenn ich es richtig sehe ist das 0x1b21 und sollte doch immer Bestand
haben auch wenn sich an der Hardware "davor" etwas ändern sollte?

Falls jemand noch eine Idee hat, hier mal der Auszug von udevadm für die
bewusste Platte.

eisfair # udevadm info --query=all --attribute-walk --name=/dev/sdg1

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.0/0000:01:00.0/ata4/host6/target6:0:0/6:0:0:0/block/sdg/sdg1':
    KERNEL=="sdg1"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{ro}=="0"
    ATTR{size}=="15628051087"
    ATTR{stat}=="    3549     8367    36644     5544    54293   526353
4645168   713816        0    32112   719276"
    ATTR{partition}=="1"
    ATTR{start}=="2048"
    ATTR{discard_alignment}=="0"
    ATTR{alignment_offset}=="0"
    ATTR{inflight}=="       0        0"

  looking at parent device
'/devices/pci0000:00/0000:00:02.0/0000:01:00.0/ata4/host6/target6:0:0/6:0:0:0/block/sdg':
    KERNELS=="sdg"
    SUBSYSTEMS=="block"
    DRIVERS==""
    ATTRS{ro}=="0"
    ATTRS{size}=="15628053168"
    ATTRS{stat}=="    3579     8497    37924     5632    54293   526353
4645168   713816        0    32200   719364"
    ATTRS{range}=="16"
    ATTRS{discard_alignment}=="0"
    ATTRS{events}==""
    ATTRS{ext_range}=="256"
    ATTRS{events_poll_msecs}=="-1"
    ATTRS{alignment_offset}=="0"
    ATTRS{inflight}=="       0        0"
    ATTRS{removable}=="0"
    ATTRS{capability}=="50"
    ATTRS{events_async}==""

  looking at parent device
'/devices/pci0000:00/0000:00:02.0/0000:01:00.0/ata4/host6/target6:0:0/6:0:0:0':
    KERNELS=="6:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{rev}=="SC61"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="6"
    ATTRS{model}=="ST8000VN0022-2EL"
    ATTRS{state}=="running"
    ATTRS{unload_heads}=="0"
    ATTRS{queue_type}=="simple"
    ATTRS{iodone_cnt}=="0xe25f"
    ATTRS{iorequest_cnt}=="0xe2a0"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{device_busy}=="0"
    ATTRS{evt_capacity_change_reported}=="0"
    ATTRS{timeout}=="30"
    ATTRS{evt_media_change}=="0"
    ATTRS{ioerr_cnt}=="0x1"
    ATTRS{queue_depth}=="31"
    ATTRS{vendor}=="ATA     "
    ATTRS{evt_soft_threshold_reached}=="0"
    ATTRS{device_blocked}=="0"
    ATTRS{evt_mode_parameter_change_reported}=="0"
    ATTRS{evt_lun_change_reported}=="0"
    ATTRS{evt_inquiry_change_reported}=="0"
    ATTRS{iocounterbits}=="32"
    ATTRS{vpd_pg80}==""
    ATTRS{vpd_pg83}==""
    ATTRS{eh_timeout}=="10"

  looking at parent device
'/devices/pci0000:00/0000:00:02.0/0000:01:00.0/ata4/host6/target6:0:0':
    KERNELS=="target6:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device
'/devices/pci0000:00/0000:00:02.0/0000:01:00.0/ata4/host6':
    KERNELS=="host6"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device
'/devices/pci0000:00/0000:00:02.0/0000:01:00.0/ata4':
    KERNELS=="ata4"
    SUBSYSTEMS==""
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:02.0/0000:01:00.0':
    KERNELS=="0000:01:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ahci"
    ATTRS{irq}=="88"
    ATTRS{subsystem_vendor}=="0x1b21"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x010601"
    ATTRS{driver_override}=="(null)"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{local_cpus}=="ff"
    ATTRS{device}=="0x0612"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}==""
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x1b21"
    ATTRS{resource3}=="@@@@"
    ATTRS{subsystem_device}=="0x1060"

  looking at parent device '/devices/pci0000:00/0000:00:02.0':
    KERNELS=="0000:00:02.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{irq}=="16"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{driver_override}=="(null)"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="ff"
    ATTRS{device}=="0x3595"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x8086"
    ATTRS{subsystem_device}=="0x0000"

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

Viele Grüße
Detlef Paschke

-- 
registered Fli4l-User #00000209
Das "Zitat des Augenblicks" gibt es nur auf
http://www.schabau.goip.de


Mehr Informationen über die Mailingliste Eisfair