You are not logged in.

#1 2017-05-16 02:10:01

gobennyb
Member
Registered: 2017-03-23
Posts: 6

[solved] Persistant device storage renaming / udev rules

Hello,

I am trying to achieve similar results as the following posts:
udev rules... and Persistent storage..

but am having trouble. Basically regardless of what udev rule values I try, the disk does not mount to the correct point on boot. I initially started at this vbox help page and have also referenced this help page as well as arch wiki pages like this one (udev) and other misc articles.

Here is the output of

udevadm info -a -p $(udevadm info -q path -n /dev/sdc)

where /dev/sdc is the device I'm hoping to remap to /dev/my_hdd%n

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:17.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc':
    KERNEL=="sdc"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{alignment_offset}=="0"
    ATTR{badblocks}==""
    ATTR{capability}=="50"
    ATTR{discard_alignment}=="0"
    ATTR{events}==""
    ATTR{events_async}==""
    ATTR{events_poll_msecs}=="-1"
    ATTR{ext_range}=="256"
    ATTR{inflight}=="       0        0"
    ATTR{range}=="16"
    ATTR{removable}=="0"
    ATTR{ro}=="0"
    ATTR{size}=="976773168"
    ATTR{stat}=="     196        0    12656      726        0        0        0        0        0      666      726"

  looking at parent device '/devices/pci0000:00/0000:00:17.0/ata5/host4/target4:0:0/4:0:0:0':
    KERNELS=="4:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    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}=="0x10e"
    ATTRS{ioerr_cnt}=="0xa"
    ATTRS{iorequest_cnt}=="0x10e"
    ATTRS{model}=="HGST HTS725050A7"
    ATTRS{ncq_prio_enable}=="0"
    ATTRS{queue_depth}=="31"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{queue_type}=="simple"
    ATTRS{rev}=="A3E0"
    ATTRS{scsi_level}=="6"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{type}=="0"
    ATTRS{unload_heads}=="0"
    ATTRS{vendor}=="ATA     "
    ATTRS{vpd_pg80}==""
    ATTRS{vpd_pg83}==""
    ATTRS{wwid}=="t10.ATA     HGST HTS725050A7E630                          RC250A1T0YRLLT"

  looking at parent device '/devices/pci0000:00/0000:00:17.0/ata5/host4/target4:0:0':
    KERNELS=="target4:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:17.0/ata5/host4':
    KERNELS=="host4"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

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

  looking at parent device '/devices/pci0000:00/0000:00:17.0':
    KERNELS=="0000:00:17.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ahci"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x010601"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0xa282"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{irq}=="122"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{local_cpus}=="f"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{revision}=="0x00"
    ATTRS{subsystem_device}=="0xb005"
    ATTRS{subsystem_vendor}=="0x1458"
    ATTRS{vendor}=="0x8086"

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

My current custom udev rule resides at

/etc/udev/rules.d/10-user-defined.rules
KERNEL=="sd*", ATTRS{model}=="HGST HTS725050A7", SYMLINK+="my_hdd%n"

I have tried to load additional kernel modules and recompile my kernel, which are

sd_mod ahci xhci_pci

My boot log can be found here. My dmesg log can be found here.

If it helps at all,

udevadm --version

gives 232.

I'd normally keep searching around but I'm pretty lost on this one as I feel like I've exhausted other pages. Any help is much appreciated. Thanks!

Last edited by gobennyb (2017-05-16 13:41:12)

Offline

#2 2017-05-16 11:20:08

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

Re: [solved] Persistant device storage renaming / udev rules

Persistent names for storage already exist in the form of labels and uuids. Please don't try to reinvent your own scheme by creating new device nodes.

Offline

#3 2017-05-16 12:28:17

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: [solved] Persistant device storage renaming / udev rules

Check out /dev/disk/by-*/* it's all there and in fstab and elsewhere you can just stick to shorthand LABEL= UUID=

Offline

#4 2017-05-16 13:40:42

gobennyb
Member
Registered: 2017-03-23
Posts: 6

Re: [solved] Persistant device storage renaming / udev rules

Thanks frostschutz, I think that does it for me. For anyone viewing this post in the future, I suppose /dev/disk/by-*/* should be able to replace /dev/my_hdd%n (as long as you don't have name clashes).

Offline

#5 2017-05-16 13:46:23

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [solved] Persistant device storage renaming / udev rules

gobennyb wrote:

as long as you don't have name clashes

If you use UUID's then there wont be any name clashes.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#6 2017-05-16 15:49:13

gobennyb
Member
Registered: 2017-03-23
Posts: 6

Re: [solved] Persistant device storage renaming / udev rules

slithery wrote:
gobennyb wrote:

as long as you don't have name clashes

If you use UUID's then there wont be any name clashes.

I'm using this scheme to create raw disks and I thought I couldn't do that, but it turns out I can. Thanks!

Offline

Board footer

Powered by FluxBB