When mounting a hard drive via UUID and another via device file, how can I make sure, that the first one is always /dev/sdaX and the second /dev/sdbX and not the other way round?
Some explanation of what I'm trying to do: I'm plugging together a raspberry pi zero, a USB hub, an external hard drive and a sd card (all powered by a power bank). Then when I power up the raspberry, it should automatically take a backup of the sd card on the external hard drive.
A simplified fstab would look like this:
... uuid=123123 /mnt/exthd ntfs rw,... 0 0 /dev/sdb1 /mnt/sdcard vfat ro,... 0 0
I can't mount the sd card via UUID, because it will change when I format the card or of course use another card.
Question is, can I be sure, that the external drive is always mounted using /dev/sda1?
Or do I have to parse for example the output of
lsblk, look which device is smaller in size, and use this device file?
Note, that I won't have any feedback from the raspberry or whatever. I have to make sure, this always works. And I think I can do the parsing myself, if necessary. The question is solely, if I have to deal with it or if there's an easier way.