LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-25-2012, 07:21 AM   #1
mgai7755
Member
 
Registered: Apr 2011
Posts: 51

Rep: Reputation: 10
Question Automount and umount of USB drives not working using udev


Hi,

I'm trying to implement the automatic creation of a mount point defined by the volume name of an usb drive when inserted and also the removing of it once unplugged.

Autmounting works as expected. However, unmounting doesn't.

It looks like the lines linked to action:=remove aren't executed at all.

Any idea to help me ?

# uname -a
Linux server 2.6.26-2-amd64 #1 SMP Mon Jun 13 16:29:33 UTC 2011 x86_64 GNU/Linux

Thanks

Here is the contents of my file 76-local.rules

Code:
# /etc/udev/rules.d/local.rules
# /etc/udev/rules.d/76-local.rules

# ADD rule: if we have a valid ID_FS_LABEL_ENC, and it's USB, mkdir and mount

ENV{ID_FS_LABEL_ENC}=="?*",   ACTION=="add",      SUBSYSTEMS=="usb", \
         RUN+="/usr/local/sbin/udev-automounter.sh %k"

# REMOVE rule

ENV{ID_FS_LABEL_ENC}=="?*",   ACTION=="remove",      SUBSYSTEMS=="usb", \
         RUN+="/usr/local/sbin/udev-auto-umounter.sh $env{ID_FS_LABEL_ENC} %k"


# Other way tried, without calling external script. Doesn't work either :

#ACTION=="add", ENV{ID_FS_LABEL_ENC}=="?*", SUBSYSTEMS=="usb", RUN+="/bin/mkdir -p /Volumes/$env{ID_FS_LABEL_ENC}"
#ACTION=="add", ENV{ID_FS_LABEL_ENC}=="?*", SUBSYSTEMS=="usb", RUN+="/bin/mount /dev/$kernel /Volumes/$env{ID_FS_LABEL_ENC}"

#ACTION=="remove", ENV{ID_FS_LABEL_ENC}=="?*", SUBSYSTEMS=="usb", RUN+="/bin/umount /dev/$kernel"
#ACTION=="remove", ENV{ID_FS_LABEL_ENC}=="?*", SUBSYSTEMS=="usb", RUN+="/bin/rmdir  /Volumes/$env{ID_FS_LABEL_ENC}"

Last edited by mgai7755; 01-25-2012 at 07:26 AM.
 
Old 01-26-2012, 02:39 AM   #2
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 385Reputation: 385Reputation: 385Reputation: 385
Are you using usbmount package?
http://usbmount.alioth.debian.org/
 
Old 01-26-2012, 04:05 AM   #3
mgai7755
Member
 
Registered: Apr 2011
Posts: 51

Original Poster
Rep: Reputation: 10
Nope. Should I ? I'd prefer to fully understand how it works before applying a ready made solution.
 
Old 01-26-2012, 04:32 AM   #4
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by mgai7755 View Post
Nope. Should I ? I'd prefer to fully understand how it works before applying a ready made solution.
No, keep trying?

Wish I could help, but will try a few myself and if I find a solution will let you know.

I personally do not use usb storage so have not thought about the auto mount. I believe some of the later-larger distros may come with it, I will check into that also.
 
  


Reply



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 Off
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
Can't umount usb cdrom drives on diskless client. Linux.tar.gz Linux - Software 0 10-23-2009 03:00 AM
automount dvd-rw, usb drives? darkangel29 Linux - Hardware 0 02-26-2007 01:08 AM
Tricky automount of USB HDU - udev is tough! laan97ac Linux - Hardware 6 12-02-2005 09:29 AM
umount USB drives, how? Whiskers SUSE / openSUSE 9 05-08-2005 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:17 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
Open Source Consulting | Domain Registration