I noticed that the devpath
attribute is constant for my USB ports. You could add a new udev
rule and create specific symlinks based on the ports the devices are plugged in then. Just add a new file into your /etc/udev/rules.d
directory, that looks like this:
#new symlink for my front USB port:
KERNELS=="2-1.8", SUBSYSTEMS=="usb", ATTRS{devpath}=="1.8", SYMLINK+="usb_port1"
and make sure it's name ends in .rules
, e.g. port1.rules
. From now on you can make the fstab
entry using /dev/usb_port1
as any device plugged into that specific port will be listed under said symlink in /dev/
. Same for the SD card and you should be settled.
What is happening is that we check for unique properties of the specific port ( the ==
parts), and once these match add (+=
) a new symlink to /dev/
.
The information on attributes you want to match canbe retrieved via udevadm info -a /dev/sdb1
(for a device sdb1
). Make sure you take attributes from only one parent device block, and that should be the one that have unique devpath
and KERNELS
entries - try with a few USB ports if available to see which ones change.
PS: udev
will also allow to run a script when plugging in a device - might come in handy for your backup needs. However I do not know if booting your system will count as plugging in, so you'll have to check the behaviour.
Best Answer
df will tell you device name and mount point, and ls will tell you device numbering: