I have a USB hub connected to my laptop, always through the same port – my question is how can I make my linux installation always mount whatever is plugged into one of the specific ports on this hub be mounted to (e.g) /mount/left and likewise for the other port.
I know how I can do this for specific drives with the UUID of the drive, but I want it to be that case that /mount/left always refer to whatever is in the left port, whichever order different USB devices are plugged in.
Best Answer
I know this is an old thread, but I came across it while looking to do the same thing, and found a solution using fstab, see below:
First, plug in a drive to the port you want to map a mountpoint to. Use
sudo blkid
to get the /dev/sd** path to the drive & note this down/remember it. I'll be using '/dev/sda1'Second, use
udevadm info --name=/dev/sda1 | grep disk/by-path
, which should give you a readout something like:It's the
platform-20980000.usb-usb-0:1.3:1.0-scsi-0:0:0:0-part1
that we want. It might look fairly different depending on your device & hub. Copy it/note it down then open up fstab configsudo nano /etc/fstab
and on a new line:replace
/media/card
with the mountpoint you desire, and make sure the bit following/dev/disk/by-path/
matches what you copied earlier. The other options are variable depending on what you want.Ctrl-X, Y, enter, to save fstab, then reboot and you should now have an auto-mounting usb port! You can repeat the previous steps for each port :)