I'm on 21.02.1 and wanted to have DLNA and Samba, unfortunately they can't both fit (just a little bit over the limit of free space), ksmbd proved not completely suitable. So I resorted to extroot but decided to put it on one small USB drive (as I tend to remove the other 128GB drive from time to time). So the thing that is bothering me:
I have two USB storage devices occupying both USB ports:
a) exroot on USB device on the USB2 port
b) 128gb storage for DLNA and SAMBA on the USB3 port
On every boot the device order/naming is random e.g. the sda1 and sdb1 will be switched. It is not big issue as I mount the partitions using the UUID but is really bothering.
Is this something known or if there is any setting to bind the name to a device?
there was a discussion on the dd-wrt forums about usb port ordering - maybe 5 years ago.
there was a script to query which device was attached to which device.
maybe start here https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=47053
i have not used hotplug scripts in openwrt - so not very helpful.
This is common on other linux distros, too. USB enumeration order is not deterministic unless they are physically inserted in a specific sequence. Multiple devices that are already connected at boot time (or in a situation such as being connected to a USB hub that is then connected to the host) will come up in a seemingly random order. I've had this with USB-serial devices in my lab at work... on linux, those devices would enumerate as ttyUSB0 and ttyUSB1, etc, in a random order.
Some OS's handle this by using unique identifiers: on the Mac, a device would enumerate as something like ttyG0134S1 (which would be the unique serial number of the device).
This is the best way to avoid the situation of random enumeration > random mount points. Typically this only needs to be done once per device in fstab, so it shouldn't be much additional effort.
Thanks for the answers, I really appreciate the extensive explanation. I'm long time Linux user but obviously thought it wrong about the USB storage devices, I was thinking as they are fixed drives and they should always be in the same order. I'll stick to the UUIDs as the best option and rename the mount points. Thanks again.