-   Linux - General (
-   -   Udev Ruless (

vijay496 04-12-2012 08:37 AM

Udev Ruless
Hi all,

I am writing a rule so that my usb drive will automatically mount to a point.

Iam new bie to this please help me out to write rules..

I tried somehow like this

created a file by name zzz.rules in /etc/udev/rules.d/
1ST Try
ACTION=="add",KERNEL=="sd?1-9]",SUBSYSTEM=="block",SUBSYSTEMS=="usb",SYMLINK+="vijayPD",RUN+="/bin/mount /dev/vijayPD /mnt"

ACTION=="remove",KERNEL=="sd?1-9]",SUBSYSTEM=="block",SUBSYSTEMS=="usb",RUN+="/bin/umount /mnt"
But not succeded infact the Symlink is getting created but it is not mounting to /mnt

when I manually typed /usr/bin/sudo /bin/mount /dev/vijayPD /mnt it is getting mounted.
2nd try
RUN+="/bin/su root -c /bin/mount /dev/vijayPD /mnt"
RUN+="/bin/su root -c /bin/umount /mnt"
3rd try
RUN+="/usr/bin/sudo /bin/mount /dev/vijayPD /mnt"
RUN+="/usr/bin/sudo /bin/umount /mnt"
I came across some threads mentioning to make use pmount and pumount and tried with it but no luck
4th try
RUN+="/usr/bin/pmount /dev/vijayPD /mnt"
RUN+="/usr/bin/pumount /mnt"
So posting here would help me.

Help me.


EricTRA 04-13-2012 02:00 AM


I've found this link very helpful when I needed to work with udev rules the first time. Hope it helps for you too.

Kind regards,


catkin 04-13-2012 02:17 AM

The mount command is /sbin/mount, not /bin/mount

BTW, IMHO the remove ACTION should not be required. The umount should happen before the remove or the file system is likely to be damaged.

onebuck 04-13-2012 03:28 PM

Moderator response
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate of

All times are GMT -5. The time now is 12:38 AM.