Although with the appropriate drivers a USB mass storage device will show up in /dev/sd when plugged in, it will not always be in the same place, usually /dev/sda1. This patch adds a usb-storage "agent" that will create a mount point (usually /mnt/usb/storage) and mount the USB drive. It handles multiple partitions, creates and symlinks an alias roughly of the form Vendor.Model to the mount point, and also tears down everything when the USB drive is removed.
Created attachment 35767 [details, diff] Patch to modify and add files to the hotplug ebuild install This patch merely modified /etc/hotplug/usb.usermap, /etc/conf.d/usb and adds the files /etc/hotplug/usb/usb-storage and /etc/hotplug/usb/usb-storage.remove. It does not patch the ebuild, which also will need to create /var/run/usb
I think that this won't work with udev, because in this moment the devicea under /dev arent't already created. The solution is to put this script under /etc/dev.d with the .dev extension. IMHO I also think that using something like hal (with the update-fstab script) and ivman will be a better solution.
Maybe, but the comments on the ivman/hal/dbus threads seem to indicate that USB sticks aren't supported (and the whole scene looks pretty flaky from the comments, IMO). When I said multiple partitions, I meant on the USB mass storage. I currently use this by having a more mnemonic name (like "/p" for "pen drive") symlinked to /mnt/usb/storage. When the pen drive is in the USB port, I can see its contents under /p; when I pull it out, ls /p just gives /p, as /mnt/sub no longer contains a storage subdirectory. This could still use a little work. If, to be safe, you "umount /p" before pulling out the drive, the mount point and its alias are not removed when the drive is pulled out. I suspect this is because the hotplug agent never receives its "remove" action event, but I haven't tracked it down. Instead, I just "sync".
Please use either HAL or /etc/dev.d for this. Or devlabel. But not a hotplug agent script, that's not the way to do this, sorry.