LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Mounting USB from Script at bootup fails (https://www.linuxquestions.org/questions/linux-general-1/mounting-usb-from-script-at-bootup-fails-604388/)

silent echo 12-04-2007 07:21 AM

Mounting USB from Script at bootup fails
 
Hello everyone ,

I am currently attempting to perform the following action on a SuSe 10 machine

(1) Modify the rclocal file to do the following at boot up
A.
Code:

mount /dev/sdb1 /tmp/usb
B.
Code:

sh /tmp/usb/run.sh

The problem is that during boot up it says

Code:

mount: special device /dev/sdb1 does not exist
But when the bootup process ends , i am able to mount the USB normally
using
Code:

mount /dev/sdb1 /tmp/usb
After checking mtab i noticed that the USB device is mounted to /media/<paritionname>


Help much appreciated

silent echo 12-04-2007 07:31 AM

I also noticed that the HAL daemon is booting after the rclocal is ran . Could it be overriding the mount point to /media/<partitioname> ?

saikee 12-04-2007 01:28 PM

I think it is known OpenSuse does not load the driver for USB devices until much later in the booting process. Generally the initrd needs to be updated to incoporate this feature. Other distros from Debian, Slax and Red Hat do not have such limitation.

silent echo 12-05-2007 02:29 AM

Thank for the reply saikee

yep i think that is defiantly the case . Even attempting to load a script at boot up at the end of run lvl 3 didn't do the trick .

So any suggestions for a work around ?

saikee 12-05-2007 10:21 AM

Never done it myself but as I said earlier you can recompile the initrd (ram disk file) to work round it. Opensuse web sites have loads of howto for it.

silent echo 12-08-2007 07:47 AM

Thanks for the help ,

I was able to fix this issue by adding a sleep command to the script before mounting the device . This ensured that the services i need had plenty of time to start .

saikee 12-08-2007 10:51 AM

You may consider posting your script here as it may be of interest to others.

silent echo 12-10-2007 03:12 AM

Code:

#**************************
# Start USB Detection
#**************************

# (0) User defined Values
mountDir="/tmp/USBSETTINGS"
PriDev="/dev/sdb1"
SecDev="/dev/sda1"
entryScript="run.sh"
sleepInterval="10"


# (1) Make mount point
mkdir $mountDir

# (2) Sleep to allow needed processes to finish starting up
sleep $sleepInterval

# (3) Mount thumb drive
mount $PriDev $mountDir
workingDev=$PriDev

  # (3.a) Test if mount was successful
  ls $mountDir | grep $entryScript
 
  if [ $? -ne 0 ]
  then
          # (3.c) Attempt mounting secondary device
          umount -l $PriDev
          mount $SecDev $mountDir
          workingDev=$SecDev
  fi
 
 
# (4) Start entry script
cd $mountDir
sh $entryScript


# (5) Clean up
umount -l $workingDev
rm -rf $mountDir


#*************************
# End USB detection
#*************************



All times are GMT -5. The time now is 07:46 AM.