<br>On Tue, May 31, 2011 at 9:46 AM, Shawn Perry <span dir="ltr"><<a href="mailto:shawn@redmop.com">shawn@redmop.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I
have a udev script that will mount anything usb drive related to
/media/<label> or /media/<other drive ID>, in that order.</blockquote><br>
<br>Shawn, does your script also work for exFat file systems on USB flash drives? Just curious since I know that this can be a bit more tricky to set up in Linux. <br>
<br>
Thanks!<br>
-Darrin<br><br><br><br><div class="gmail_quote">On Tue, May 31, 2011 at 9:46 AM, Shawn Perry <span dir="ltr"><<a href="mailto:shawn@redmop.com">shawn@redmop.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I have a udev script that will mount anything usb drive related to /media/<label> or /media/<other drive ID>, in that order.<div><br></div><div><div># Test rule for automounting a usb stick to either /media/{ID_FS_LABEL} if it</div>
<div># has a label or /media/usbhd-%k if it doesn't have one and then running a</div><div># script on it (commented out below).</div><div><br></div><div># udev rule by Shawn T Perry</div><div># Contact Info: c:<a href="tel:720-319-7627" value="+17203197627" target="_blank">720-319-7627</a> <a href="mailto:e%3Ashawn@redmop.com" target="_blank">e:shawn@redmop.com</a></div>
<div><br></div><div># Skip rule if not a disk</div><div>KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"</div><div><br></div><div># Import FS infos</div><div>IMPORT{program}="/sbin/blkid -o udev -p %N"</div>
<div><br></div><div># Get a label if present, otherwise specify one</div><div>ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"</div><div>ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"</div>
<div><br></div><div># Global mount options</div><div>ACTION=="add", ENV{mount_options}="relatime"</div><div># Filesystem-specific mount options</div><div>ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"</div>
<div><br></div><div><br></div><div># Make directory for automounting</div><div>ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"</div><div># automount ntfs filesystems using ntfs-3g driver</div>
<div>ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"</div><div># automount all other filesystems</div><div>ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"</div>
<div><br></div><div><br></div><div># Run Script</div><div>#ACTION=="add", RUN+="/root/bin/<a href="http://test.pl" target="_blank">test.pl</a> %k %E{ID_MODEL_ID}"</div><div><br></div><div><br></div><div>
# Clean up after removal</div>
<div>ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"</div><div><br></div><div># Exit</div><div>LABEL="media_by_label_auto_mount_end"</div>
<br><br>Shawn T Perry<br>Red Mop Computing Services<br>email: <a href="mailto:shawn@redmop.com" target="_blank">shawn@redmop.com</a><br>office: <a href="tel:720-319-7627" value="+17203197627" target="_blank">720-319-7627</a><br>
cell: <a href="tel:303-881-2623" value="+13038812623" target="_blank">303-881-2623</a><br>web: <a href="http://www.redmop.com/" target="_blank">http://www.redmop.com</a><br>
facebook: <a href="http://www.facebook.com/pages/Red-Mop-Computing-Services/114352628589778" target="_blank">http://www.facebook.com/pages/Red-Mop-Computing-Services/114352628589778</a><br>linkedin: <a href="http://www.linkedin.com/in/shawnperry" target="_blank">http://www.linkedin.com/in/shawnperry</a><div>
<div></div><div class="h5"><br>
<br><br><div class="gmail_quote">On Tue, May 31, 2011 at 9:32 AM, marcus hall <span dir="ltr"><<a href="mailto:marcus@tuells.org" target="_blank">marcus@tuells.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On Mon, May 30, 2011 at 4:57 PM, Louis Miller <<a href="mailto:veganguy@canadaseek.com" target="_blank">veganguy@canadaseek.com</a>> wrote:<br>
<br>
> I'm trying to switch from Ubuntu to Debian. I plugged in my USB hard<br>
> drive into Ubuntu and it always recognizes it and puts the little icon on<br>
> the screen. With Debian, they don't make it quite so easy. My hard drive<br>
> didn't get mounted. I went<br>
<br>
</div>Depending on which version of Debian you are using, there may be two paths to<br>
look into.. The 'hal' process is deprecated and distributions are going<br>
through the process of removing it. You probably want to try to find out if<br>
the version of debian you are using has done this or not (Ubuntu 11.04 has<br>
removed hal).<br>
<br>
If hal has not been removed, then it plays a big part in automounting usb<br>
devices. If it has been removed, then aparently the udev process cooperates<br>
with the volume manager to get things mounted.<br>
<br>
The whole strategy seems to be relatively undocumented, and I have a<br>
mythbuntu box that has been updated to 11.04 and is now no longer automounting<br>
usb devices. I can see (via "udevadm monitor") that udev detects the<br>
device being plugged in, but I'm still searching for the next step in the<br>
chain. I think that I need to be looking into the thunar volume manager<br>
next, but I haven't dug much into that yet. (Not a huge priority at the<br>
moment, so I may not get around to it for some time yet...)<br>
<font color="#888888"><br>
marcus hall<br>
<a href="mailto:marcus@tuells.org" target="_blank">marcus@tuells.org</a><br>
</font><div><div></div><div>_______________________________________________<br>
clue mailing list<br>
<a href="mailto:clue@cluedenver.org" target="_blank">clue@cluedenver.org</a><br>
<a href="http://cluedenver.org/mailman/listinfo/clue" target="_blank">http://cluedenver.org/mailman/listinfo/clue</a><br>
</div></div></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
clue mailing list<br>
<a href="mailto:clue@cluedenver.org">clue@cluedenver.org</a><br>
<a href="http://cluedenver.org/mailman/listinfo/clue" target="_blank">http://cluedenver.org/mailman/listinfo/clue</a><br></blockquote></div><br>