>>>>> On Thu, 11 Feb 2021 08:23:07 +0100, Carsten Aulbert 
>>>>> <carsten.aulb...@aei.mpg.de> said:


    > I assume udevadm would return any of the valid device links and by-path 
    > is always set, thus:

    > get_stable_devname() {
    >      _DEV="$1"
This does not work, because the order of links returned by udevadm
changes with every call.


[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/wwn-0x50014ee35570a5e8 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-id/wwn-0x50014ee35570a5e8 
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068 
/dev/disk/by-id/wwn-0x50014ee35570a5e8
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-id/wwn-0x50014ee35570a5e8 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068 
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068 
/dev/disk/by-id/wwn-0x50014ee35570a5e8
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/wwn-0x50014ee35570a5e8 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068 
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/wwn-0x50014ee35570a5e8
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068 
/dev/disk/by-id/wwn-0x50014ee35570a5e8
[~]$ udevadm info -r --query=symlink /dev/sda
/dev/disk/by-id/ata-WDC_WD3000FYYZ-01UL1B0_WD-WMC1F0499068 
/dev/disk/by-path/pci-0000:01:00.0-sas-exp0x500304800096b4bf-phy17-lun-0 
/dev/disk/by-id/wwn-0x50014ee35570a5e8


-- 
viele Grüße Thomas

Antwort per Email an