How to fix a permanent mount point to my sdcard reader

  • Hi there !
    I have recently noticed that my case sdcard reader, linked to my motherboard via an internal USB port, switch between /dev/sdc <=> /dev/sdd from time to time depending on reboot.


    I would like to give it a specific place, like /dev/sdz.

    Code
    /etc/udev/rules.d/10-local.rules


    I have some reading and found that it can be done with a rule in /etc/udev/rules.d
    Any help would be greatly appreciated to write this rule.


    Here are the info I can find on my SDCard


    # udevadm info --query=all --name=/dev/sdd
    P: /devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0/host8/target8:0:0/8:0:0:0/block/sdd
    N: sdd
    S: disk/by-id/usb-Generic_USB2.0_Card_Reader_12345678901234567890-0:0
    S: disk/by-path/pci-0000:00:1d.7-usb-0:1:1.0-scsi-0:0:0:0
    E: DEVLINKS=/dev/disk/by-id/usb-Generic_USB2.0_Card_Reader_12345678901234567890-0:0 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:1:1.0-scsi-0:0:0:0
    E: DEVNAME=/dev/sdd
    E: DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0/host8/target8:0:0/8:0:0:0/block/sdd
    E: DEVTYPE=disk
    E: ID_BUS=usb
    E: ID_INSTANCE=0:0
    E: ID_MODEL=USB2.0_Card_Reader
    E: ID_MODEL_ENC=USB2.0\x20Card\x20Reader\x20\x20
    E: ID_MODEL_ID=6000
    E: ID_PATH=pci-0000:00:1d.7-usb-0:1:1.0-scsi-0:0:0:0
    E: ID_PATH_TAG=pci-0000_00_1d_7-usb-0_1_1_0-scsi-0_0_0_0
    E: ID_REVISION=6000
    E: ID_SERIAL=Generic_USB2.0_Card_Reader_12345678901234567890-0:0
    E: ID_SERIAL_SHORT=12345678901234567890
    E: ID_TYPE=disk
    E: ID_USB_DRIVER=usb-storage
    E: ID_USB_INTERFACES=:080650:
    E: ID_USB_INTERFACE_NUM=00
    E: ID_VENDOR=Generic
    E: ID_VENDOR_ENC=Generic\x20
    E: ID_VENDOR_ID=090c
    E: MAJOR=8
    E: MINOR=48
    E: SUBSYSTEM=block
    E: TAGS=:systemd:
    E: USEC_INITIALIZED=2500327


    # udevadm info -a --name=/dev/sdd
    looking at device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0/host8/target8:0:0/8:0:0:0/block/sdd':
    KERNEL=="sdd"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{alignment_offset}=="0"
    ATTR{capability}=="51"
    ATTR{discard_alignment}=="0"
    ATTR{events}=="media_change"
    ATTR{events_async}==""
    ATTR{events_poll_msecs}=="-1"
    ATTR{ext_range}=="256"
    ATTR{inflight}==" 0 0"
    ATTR{range}=="16"
    ATTR{removable}=="1"
    ATTR{ro}=="0"
    ATTR{size}=="0"
    ATTR{stat}==" 0 0 0 0 0 0 0 0 0 0 0"


    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0/host8/target8:0:0/8:0:0:0':
    KERNELS=="8: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}=="0x60d1"
    ATTRS{ioerr_cnt}=="0x60d0"
    ATTRS{iorequest_cnt}=="0x60d1"
    ATTRS{max_sectors}=="240"
    ATTRS{model}==" "
    ATTRS{queue_depth}=="1"
    ATTRS{queue_type}=="none"
    ATTRS{rev}=="6000"
    ATTRS{scsi_level}=="0"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{type}=="0"
    ATTRS{vendor}=="Generic "


    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0/host8/target8:0:0':
    KERNELS=="target8:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""
    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0/host8':
    KERNELS=="host8"
    SUBSYSTEMS=="scsi"
    DRIVERS==""
    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1:1.0':
    KERNELS=="4-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb-storage"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="08"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="50"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{supports_autosuspend}=="1"


    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1':
    KERNELS=="4-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="500mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bmAttributes}=="80"
    ATTRS{busnum}=="4"
    ATTRS{configuration}==""
    ATTRS{devnum}=="2"
    ATTRS{devpath}=="1"
    ATTRS{idProduct}=="6000"
    ATTRS{idVendor}=="090c"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Generic , . "
    ATTRS{maxchild}=="0"
    ATTRS{product}=="USB2.0 Card Reader "
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{serial}=="12345678901234567890"
    ATTRS{speed}=="480"
    ATTRS{urbnum}=="123934"
    ATTRS{version}==" 2.00"


    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4':
    KERNELS=="usb4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0414"
    ATTRS{bmAttributes}=="e0"
    ATTRS{busnum}=="4"
    ATTRS{configuration}==""
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 4.14.0-0.bpo.3-amd64 ehci_hcd"
    ATTRS{maxchild}=="6"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{serial}=="0000:00:1d.7"
    ATTRS{speed}=="480"
    ATTRS{urbnum}=="32"
    ATTRS{version}==" 2.00"


    looking at parent device '/devices/pci0000:00/0000:00:1d.7':
    KERNELS=="0000:00:1d.7"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci-pci"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x0c0320"
    ATTRS{companion}==""
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x293a"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{irq}=="23"
    ATTRS{local_cpulist}=="0-1"
    ATTRS{local_cpus}=="3"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{revision}=="0x02"
    ATTRS{subsystem_device}=="0x5006"
    ATTRS{subsystem_vendor}=="0x1458"
    ATTRS{uframe_periodic_max}=="100"
    ATTRS{vendor}=="0x8086"
    looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    2 Mal editiert, zuletzt von sbocquet ()

    • Offizieller Beitrag

    Your usb sdcard reader isn't getting the device name. The sd card itself is. So, you would have to have a rule for each sd card. Why not use /dev/disk/by-label or by-id?

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Hi Aaron,


    First, thanks a lot for the help.


    Do you mean adding an entry in /etc/fstab for the SD card reader ?
    In fact, I never use it (lol), but this make my 7 drives switch at every reboot too, and I clearly don't like that with my ZFS pool. So I was planning to link the sdcard reader to /dev/sdz, and let OMV do the thing for the HDDs.



    Here's what I have:


    # ls -al /dev/disk/by-id/
    total 0
    drwxr-xr-x 2 root root 1060 avril 11 22:45 .
    drwxr-xr-x 8 root root 160 avril 11 22:45 ..
    ...
    lrwxrwxrwx 1 root root 9 avril 11 22:45 usb-Generic_USB2.0_Card_Reader_12345678901234567890-0:0 -> ../../sdd
    ...

    Code
    # ls -al /dev/disk/by-id/
    total 0
    drwxr-xr-x 2 root root 1060 avril 11 22:45 .
    drwxr-xr-x 8 root root  160 avril 11 22:45 ..
    ...
    lrwxrwxrwx 1 root root    9 avril 11 22:45 usb-Generic_USB2.0_Card_Reader_12345678901234567890-0:0 -> ../../sdd

    So I should add this line the /etc/fstab?

    Code
    /dev/disk/by-id/usb-Generic_USB2.0_Card_Reader_12345678901234567890-0:0    /dev/sdz    vfat   defaults        0       0



    Else, I think I can add this rule

    Code
    # cat 10-sdcard-reader.rules
    # Fix SD-card reader to /dev/sdz
    KERNEL=="sdz", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{product}=="USB2.0 Card Reader ", NAME{all_partitions}="sd-card"


    What do you think?

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    • Offizieller Beitrag

    I clearly don't like that with my ZFS pool.

    Did you by-id for your zfs pool?


    So I should add this line the /etc/fstab?

    I wouldn't add that line. You are trying to mount device on another device. I would do something like:


    /dev/disk/by-id/usb-Generic_USB2.0_Card_Reader_12345678901234567890-0:0 /mnt/usb vfat defaults 0 0


    But that still seems like it would only work with one card especially if other cards are not vfat.


    What do you think?

    Try it :)

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • For my ZFS Pool, I have used the plugin, so at the moment, I don't know how it is mounted. I have to check what the plugin does exactly.


    Oups... I just wrote the fstab line from memories.
    But you're right, there is no card and FS in it. That's why I was first planning to use a udev rule, should be a better solution.


    EDIT: That what was I expected. No support in /dev/sdd, no mount


    root@home-server:/mnt# mkdir sd-card
    root@home-server:/mnt# mount /dev/disk/by-id/usb-Generic_USB2.0_Card_Reader_12345678901234567890-0\:0 /mnt/sd-card
    mount: aucun support trouvé dans /dev/sdd

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    Einmal editiert, zuletzt von sbocquet ()

  • ok, so I chnaged the rule I try to write as I misunderstood the way it works.


    http://www.reactivated.net/writing_udev_rules.html

    Code
    # cat 50-sdcard-reader.rules
    
    
    # Fix SD-card reader to /dev/sdz, alias /dev/sd-card
    KERNEL=="sd[a-z]", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{product}=="USB2.0 Card Reader ", NAME{all_partitions}="sdz", SYMLINK+="sd-card"


    I then run

    Code
    # udevadm trigger -v


    Here are the rules for /dev/sdd




    According to that node, it was hoping it should work:


    looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb4/4-1':
    KERNELS=="4-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"

    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="500mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bmAttributes}=="80"
    ATTRS{busnum}=="4"
    ATTRS{configuration}==""
    ATTRS{devnum}=="2"
    ATTRS{devpath}=="1"
    ATTRS{idProduct}=="6000"
    ATTRS{idVendor}=="090c"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Generic , . "
    ATTRS{maxchild}=="0"
    ATTRS{product}=="USB2.0 Card Reader "
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{serial}=="12345678901234567890"
    ATTRS{speed}=="480"
    ATTRS{urbnum}=="123934"
    ATTRS{version}==" 2.00"


    unfortunatly not... sd-card is still at /dev/sdd, but can't understand why???

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    • Offizieller Beitrag

    Did you try rebooting? I didn't think udev would move something already assigned.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Yes, I did... I must missed something, but what...

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

    • Offizieller Beitrag

    Not sure. Is your end goal to mount it? If it is, maybe try systemd instead of udev. The usbbackup plugin is using systemd to mount a drive when it is plugged in.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • In fact, the main goal is just to move the SD card reader out of my HDD range.


    I would like to keep it fonctional even if I don't use it very often, because it is on the same "card" as my 2 front USB ports (else, I can just unplug it, but it would unplug all the "card", SD reader and USB ports ;) )

    Lian Li PC-V354 (with Be Quiet! Silent Wings 3 fans)
    ASRock Rack x470D4U | AMD Ryzen 5 3600 | Crucial 16GB DDR4 2666MHz ECC | Intel x550T2 10Gb NIC

    1 x ADATA 8200 Pro 256MB NVMe for System/Caches/Logs/Downloads
    5 x Western Digital 10To HDD in RAID 6 for Datas
    1 x Western Digital 2To HDD for Backups

    Powered by OMV v5.6.26 & Linux kernel 5.10.x

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!