WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Automount USB with UDEV rules, Problem [SOLVED WITH RESTRICTIONS]  (Read 35894 times)

Offline mindmachine

  • Newbie
  • *
  • Posts: 45
Re: Automount USB with UDEV rules, Problem
« Reply #75 on: March 15, 2013, 09:41:34 AM »
Just tested your script. It works nicely, when devices are plugged in to a running system. But when already plugged in at boot, they don`t get mounted at all, although it might be, that I made a mistake somewhere, by perhaps placing it on the wrong place in bootlocal.sh? Could someone please recheck this?
By plugging in while system is running, it mounts ntfs, fat16 and fat32 without problems as rewritable. 
EDIT:
For anyone willing to use the above script by Rich, here is the working umount script:
Quote
#!/bin/sh
for i in $(cat /etc/fstab | grep $1 | cut -c 6-9) ## create correct variable i in case partition number is missing
do
[ -z $i ] && continue
umount /mnt/$i
sleep 1
rmdir /mnt/$1
rebuildfstab
done
Edit as of "my brain came back"
Quote
But when already plugged in at boot, they don`t get mounted at all
Well, stupid me, of course it won't get mounted .... lol!!! Sorry!!
« Last Edit: March 15, 2013, 07:47:44 PM by mindmachine »
------------------------------------------------------------
mindmachine

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11629
Re: Automount USB with UDEV rules, Problem
« Reply #76 on: March 16, 2013, 01:40:50 AM »
Hi mindmachine
I forgot to mention you want the script to run in the background, so if you called the script automount.sh, your
bootlocal.sh would contain:
Code: [Select]
/Path/To/automount.sh &Without the  &  symbol, the script will run in the foreground and any commands in bootlocal.sh that are listed after
automount.sh will not execute.

Offline mindmachine

  • Newbie
  • *
  • Posts: 45
Re: Automount USB with UDEV rules, Problem [SOLVED WITH RESTRICTIONS]
« Reply #77 on: March 16, 2013, 08:22:51 AM »
Yepp, I know. Had done that already...
I published your solution at post 1 and also made clear that it may be potentially harmful to usb devices. Still it is a solution and as I can't think of a better way to get USB-stick automounted, this will do :-).

Many thanks for your friendly support. I appreciate this a lot and did learn again a lot about scripting and the way, Linux behaves.
------------------------------------------------------------
mindmachine