Assign each disk to constant /dev/sdX #need-help

  • I'm running an OMV server on a mini-PC with 1 SSD as boot and 4 external drives as storage. System randomly keeps on assigning /dev/sd[a-z] to external drives which sometimes fails to auto-mount due to this situation. I would like to assign each Disk a fixed /dev/sdX

    From what I read till now : I'm should "Persistent block device name", since I can change partitions in future, it should be done by-id.

    Firstly Identify Disk by its Serial, via udevadm info /dev/sdX, note ID_SERIAL_SHORT

    Then nano /etc/udev/rules.d/99-openmediavault-dev-disk-by-id.rules

    ADD ACTION=="add", KERNEL=="sd[a-z]", ENV{ID_SERIAL_SHORT}=="X5ER1ALX", RUN+="/path/to/script /dev/%k"

    eg: for my 4TB external ID_SERIAL_SHORT=XYZ123ABC456 which I want on /dev/sdb

    ADD ACTION=="add", KERNEL=="sdb", ENV{ID_SERIAL_SHORT}=="XYZ123ABC456", RUN+="/path/to/script /dev/%k"

    Tried this on my server. After reboot it it was still assigned the old /dev/sdX I don't really understand the second half of the script, there maybe in issue there I cant understand.

    • Offizieller Beitrag

    external drives which sometimes fails to auto-mount due to this situation.

    The mounts shouldn't be using the device path. It should be mounting with filesystem uuid and then the device path doesn't matter if it changes. What does your /etc/fstab look like?

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.6 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


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


    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!

  • Thanks ryecoaaron
    Attached is the output for /etc/fstab and blkid and a picture of my file system
    Drive Label Files and WD512GB are ones that usually give mount issues. They are both connected via USB 3.0 Enclosure

    The device was not even unplugged, this happens after a reboot.


    Found that people have faced similar issue with mounting but it was related to there hardware I suppose

    https://github.com/openmediava…46#issuecomment-650265228

    I have posted this problem multiple places but couldn't find a solution yet.
    if its not achievable by-id then any guide for doing this by-UUID

    Have to admit that I have a little OCD and drives not showing up as I intended them to be is a bit bothersome^^

    • Offizieller Beitrag

    Your fstab isn't causing the problem. I am guessing that the usb drives are ready at boot time. After reboot, does sudo mount -a fix the issue?

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.6 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


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


    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!

Jetzt mitmachen!

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