<br>On Tue, May 31, 2011 at 9:46 AM, Shawn Perry <span dir="ltr">&lt;<a href="mailto:shawn@redmop.com">shawn@redmop.com</a>&gt;</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/&lt;label&gt; or /media/&lt;other drive ID&gt;, 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">&lt;<a href="mailto:shawn@redmop.com">shawn@redmop.com</a>&gt;</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/&lt;label&gt; or /media/&lt;other drive ID&gt;, 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&#39;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!=&quot;sd[a-z][0-9]&quot;, GOTO=&quot;media_by_label_auto_mount_end&quot;</div><div><br></div><div># Import FS infos</div><div>IMPORT{program}=&quot;/sbin/blkid -o udev -p %N&quot;</div>


<div><br></div><div># Get a label if present, otherwise specify one</div><div>ENV{ID_FS_LABEL}!=&quot;&quot;, ENV{dir_name}=&quot;%E{ID_FS_LABEL}&quot;</div><div>ENV{ID_FS_LABEL}==&quot;&quot;, ENV{dir_name}=&quot;usbhd-%k&quot;</div>


<div><br></div><div># Global mount options</div><div>ACTION==&quot;add&quot;, ENV{mount_options}=&quot;relatime&quot;</div><div># Filesystem-specific mount options</div><div>ACTION==&quot;add&quot;, ENV{ID_FS_TYPE}==&quot;vfat|ntfs&quot;, ENV{mount_options}=&quot;$env{mount_options},utf8,gid=100,umask=002&quot;</div>


<div><br></div><div><br></div><div># Make directory for automounting</div><div>ACTION==&quot;add&quot;, RUN+=&quot;/bin/mkdir -p &#39;/media/%E{dir_name}&#39;&quot;</div><div># automount ntfs filesystems using ntfs-3g driver</div>


<div>ACTION==&quot;add&quot;, ENV{ID_FS_TYPE}==&quot;ntfs&quot;, RUN+=&quot;/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k &#39;/media/%E{dir_name}&#39;&quot;</div><div># automount all other filesystems</div><div>ACTION==&quot;add&quot;, ENV{ID_FS_TYPE}!=&quot;ntfs&quot;, RUN+=&quot;/bin/mount -t auto -o %E{mount_options} /dev/%k &#39;/media/%E{dir_name}&#39;&quot;</div>


<div><br></div><div><br></div><div># Run Script</div><div>#ACTION==&quot;add&quot;, RUN+=&quot;/root/bin/<a href="http://test.pl" target="_blank">test.pl</a> %k %E{ID_MODEL_ID}&quot;</div><div><br></div><div><br></div><div>
# Clean up after removal</div>

<div>ACTION==&quot;remove&quot;, ENV{dir_name}!=&quot;&quot;, RUN+=&quot;/bin/umount -l /media/%E{dir_name}&quot;, RUN+=&quot;/bin/rmdir /media/%E{dir_name}&quot;</div><div><br></div><div># Exit</div><div>LABEL=&quot;media_by_label_auto_mount_end&quot;</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">&lt;<a href="mailto:marcus@tuells.org" target="_blank">marcus@tuells.org</a>&gt;</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 &lt;<a href="mailto:veganguy@canadaseek.com" target="_blank">veganguy@canadaseek.com</a>&gt; wrote:<br>
<br>
&gt;       I&#39;m trying to switch from Ubuntu to Debian. I plugged in my USB hard<br>
&gt; drive into Ubuntu and it always recognizes it and puts the little icon on<br>
&gt; the screen. With Debian, they don&#39;t make it quite so easy. My hard drive<br>
&gt; didn&#39;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 &#39;hal&#39; 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 &quot;udevadm monitor&quot;) that udev detects the<br>
device being plugged in, but I&#39;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&#39;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>