It can be done! Many thanks to the Archlinux people. See
https://wiki.archlinux.org/index.php...out_udev_rules
So I created a rule named 11-media-by-label-automount.rules in /etc/udev/rules.d, and it actually works. Problem is, I cannot unmount the drive now except with sudo; I get the following error: umount: /media/backup is not in the fstab (and you are not root). I'll keep working on it, but I'd better post this to encourage others to help me.
##Code:
# Leave sda to fstab
KERNEL!="sd[b-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Import FS info
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
# Mount options
ACTION=="add", ENV{ID_FS_TYPE}=="ext3|ext4", ENV{mount_options}="rw,nosuid,nodev,relatime,acl,uhelper=udisks"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="rw,relatime,utf8,gid=46,umask=002,uhelper=udisks"
ACTION=="add", ENV{ID_FS_TYPE}=="hfsplus", ENV{mount_options}="rw,nosuid,nodev,uhelper=udisks"
# Mount the device (The "EFI" and "swap" entries are only necessary if you have a Mac and use usb boot disks with swap partitions on them)
ACTION=="add", ENV{ID_FS_LABEL}!="EFI", ENV{ID_FS_TYPE}!="swap", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -t %E{ID_FS_TYPE} -o %E{mount_options} /dev/%k /media/%E{dir_name}"
# Clean up after removal
ACTION=="remove", ENV{ID_FS_LABEL}!="EFI", ENV{ID_FS_TYPE}!="swap", RUN+="/bin/umount /dev/%k", RUN+="/bin/rmdir /media/%E{dir_name}"
# Exit
LABEL="media_by_label_auto_mount_end"
This works when copied to /etc/udev/rules.d/11-some-name.rules or /etc/udev/user.rules (the exact number does not seem to matter much), but unmounting as user does not work, also the devices appear twice in the nautilus side pane (a sure sign that something is fishy). Does udev use mount at all by default? And what else is there?
The file /lib/udev/rules.d/50-udev-default.rules does not seem to have a KERNEL=="sd*" entry at all, so maybe that's the problem. Another problem is that the entries in /media will remain if the disk is unmounted but not actually unplugged, which will cause my backup scripts to fill up the root partition (this never happens with the default udev setup. Of course I could rewrite the scripts if necessary, but I'd rather fix this behaviour).
Edit: Cleaned up the udev rule and backup script. The new rule will at least allow me to select all partitions with rubber-band selection an unmount them all at once, which was not possible before. But the devices still appear twice in the nautilus side pane (a bug that goes back several years apparently), and after unmounting the empty directories in /media are not removed until the disk is actually unplugged. I think I'll just use the script. It seems udev is just too buggy to mess with.
I wish I could mark this thread as solved, but it isn't.