LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 04-12-2012, 07:37 AM   #1
vijay496
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Rep: Reputation: Disabled
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.

Thanks,
VJ
 
Old 04-13-2012, 01:00 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

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,

Eric
 
Old 04-13-2012, 01:17 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
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.
 
Old 04-13-2012, 02:28 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,097
Blog Entries: 28

Rep: Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317Reputation: 2317
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 http://www.linuxquestions.org/questi...3/#post4650938
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
UDEV: Unable to run a command line interface script after USB automount using udev mohamr2 Linux - Embedded & Single-board computer 8 08-16-2011 10:39 AM
[SOLVED] Chose udev for services... udev starts twice... hotplug fails flipjarg Linux - Newbie 2 09-19-2010 12:49 PM
UDEV - SBLive(emu10k) - Mandriva hangs at UDEV during boot.....still! Grrr. peterlowrie Linux - Hardware 2 05-23-2010 06:37 PM
current users - udev-128 - don't forget rc.udev.new! tobyl Slackware 3 10-08-2008 03:28 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration