I used to do auto-mounting with udev like this:
# cat /etc/udev/rules.d/10-aaa.rules KERNEL=="sda1", SUBSYSTEM=="block", RUN+="/etc/mymount.sh" # cat /etc/mymount.sh #!/bin/sh if [ "$ACTION" = "add" ]; then # Do some stuff mount /dev/sda1 elif [ "$ACTION" = "remove" ]; then # Do some other stuff umount /mnt/usba fi # cat /etc/fstab | grep sda1 /dev/sda1 /mnt/usba ext4 auto,rw,noatime,user 0 0
However I noticed that the letter for my drive may change, so I changed the
fstab entry to this
PARTUUID=12345678-01 /mnt/usba ext4 auto,rw,noatime,user 0 0
But it's no longer working because
/dev/sda* is permantly attached (another drive) and I can't simply change the udev rule to
sdb. How can I configure my udev rule so that it gets mounted correctly?