You can specify attributes for the udev rule to tell what drive is being attached. I got this working - have a look at
this link for details. in particular look at the Ubuntu forum link in my link posts for details of getting these attributes using udevmonitor.
Since that post I have modifed my udev rule to work better from the Vendor and Product attributes. It now mounts and dismounts my drive partitions when attached or detached - both are mounted or dismounted at the same time as they are partitions on the one USB attached drive. Here's a copy of my most recent udev rule - obviously your attributes will differ.
Note that I need entries in fstab to map UUID's of the partitiions to mount points. Here's my udev rules :
Code:
ATTRS{idVendor}=="059b", ATTRS{idProduct}=="0370",ACTION=="add",RUN+="/bin/mount /home/ed/spare13"
ATTRS{idVendor}=="059b", ATTRS{idProduct}=="0370",ACTION=="add",RUN+="/bin/mount /home/ed/spare14",GOTO="device_end"
ENV{ID_VENDOR}=="ST310005",ACTION=="remove",RUN+="/bin/umount /home/ed/spare13"
ENV{ID_VENDOR}=="ST310005",ACTION=="remove",RUN+="/bin/umount /home/ed/spare14"
LABEL="device_end"
This was the only way I could get the two mount/umount commands to work when the drive was plugged in or unplugged, (there's two partitions to be mounted), and here's the relevant parts of fstab - obviously your UUID's will be different:
Code:
UUID=235ea638-6011-42f9-8f78-8383f117e8a1 /home/ed/spare13 ext2 defaults 0 0
UUID=9f902108-cde7-4cae-bc86-b15f88d59501 /home/ed/spare14 ext3 defaults 0 0
. You will need to look up getting and setting udev device attributes and getting and setting UUID's but there are lots of links around.
This now works if the drive is attached on boot up or perhaps later and when disattached.
Good luck with this.