Tech Support > Operating Systems > Linux / Variants > How do I make mount wait for modules to load
How do I make mount wait for modules to load
Posted by JD on July 16th, 2003


Hi all, I'm having some issues with mounting a USB flash drive at boot
time.

I'm using Slackware 8.1 with the kernel upgraded to 2.4.21. rc.modules is
being run from rc.S, and all the appropriate modules are being loaded to
support my device. Further down in rc.S I attempt to mount the drive
("mount -t umsdos /dev/sda1 /cnf"), but the modules aren't finished loading
yet and the mount fails with "mount special device /dev/sda1 does not
exist". Once the system boots, I can use the mount command from the
command line with no problem.

If I do something ugly like put in a "sleep 5" after running rc.modules,
the mount works, but I want to do this in a more elegant way, because boot
time is critical for this project and I can't afford to waste seconds, and
I have no way of knowing how long a wait is long enough.

I tried adding the line "alias /dev/sd* usb-storage" to modules.conf hoping
that the mount command would automatically load the usb-storage module,
which it does. But this still doesn't work because mount doesn't wait for
the module to finish loading before trying to mount the device. Removing
modules and then running mount from the command line fails the first time
through, but the modules do get loaded. A second mount command works fine.

I suppose I can write a script that waits for the device to show up in
/proc/scsi/scsi before doing the mount, but I was hoping for something more
automatic. Any suggestions for a better solution then "sleep" are
appreciated.

Posted by Dances With Crows on July 16th, 2003


On Wed, 16 Jul 2003 18:27:09 GMT, JD staggered into the Black Sun and
said:
"Issues"? Fucking euphemisms. A *problem* won't go away because you
refer to it as a fucking "issue".

Why does it needed to be mounted at boot time? Unless the device is
guaranteed to be there, it shouldn't be mounted at boot. USB devices,
since they're not permanently attached to their hosts in most
circumstances, should not be mounted at boot time.

If you have full control over the hardware, you know nobody's going to
be plugging anything weird in, and you can guarantee that the USB device
will be present at boot time, why not just build USB core support, USB
chipset support, and USB Mass Storage support into the kernel? No need
to wait for module loading then. If this is some sort of embedded
device, you already know what's going to be present in terms of
hardware, so use that knowledge to your advantage.

Or mount the device later on, manually, via the Slack equivalent of
/etc/init.d/local ?

If timing is so critical that 5 extra seconds of boot time kills the
project, forget elegance. Try compiling the junk you need into the
kernel first, then write that script that polls /proc/scsi/scsi .

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /
http://www.brainbench.com / "He is a rhythmic movement of the
-----------------------------/ penguins, is Tux." --MegaHAL

Posted by Michael Heiming on July 16th, 2003


JD <bogus@hotmail.com> wrote:
$ man mkinitrd

Good luck

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM