Problem with random disks mount sequence

William Case billlinux at rogers.com
Wed Dec 12 18:17:53 UTC 2007


Hi Mikkel;

Your explanation is of great interest to me at the moment.  I am trying
to trace exactly how the devices attached to my computer first get
registered.  I just need someone to point me to the mechanism or kernel
code.

On Wed, 2007-12-12 at 07:59 -0600, Mikkel L. Ellertson wrote:
> Tim wrote:

> > 
> A slight correction. It is not the BIOS oder that determines the of
> the drives under Linux. It is the kernel. What I would expect to
> happen is that you would only have the drivers for the drive with
> root file system loaded in the initrd, 
This is handed over by grub from BIOS to initrd?

> and the scan order would
What and where is the kernel function that scans?  What does scanning in
functional terms mean?  If you don't have the name of the function off
the top of your head, suggest where I might look in kernel code.

> always be the same unless you physically change drive connections or
> add drives. (Or use a kernel parameter to change the order.)
> 
> With SATA drives and USB drives, the USB drive should always be
> discovered later then the  SATA drive because the usb_storage driver
> should not be loaded until after the root file system is mounted.
>                                                       But if the
> usb_storage module is in the initrd, then things are not as clear.
> It should still find things in the same order, but in this case, it
> isn't.
> 
> One other thing that I should have commented on earlier - there is
> nothing that says that the root file system has to be on the first
> SCSI drive, so the system can use that in determining what drive
> should be /dev/sda. It used to be fairly common in dual boot systems
> to have Window on the first drive, and Linux on the second drive.
> 

I know I can view attached devices through cat /dev/* or cat /sys/*.
But those file systems just reflect a read-only view of an existing
kernel file struct (I think).  How does the kernel, as it scans, place
the data in the struct (or table) and what are the structs called? Isn't
hwconfig just a user view?  Again pointing in the right direction is
sufficient for me?

> Mikkel
> -- 

I have been trying to trace (for interest and completeness of
understanding) how device data first gets into the kernel for over a
month now.  I have read endless number of sites regarding standards,
naming protocols, address protocols, modules, drivers, BIOS and grub.
All have been helpful and all have been ultimately understandable.  But
words like "probes for", "registers" etc. for devices are never
explained.

P.S.  I even have a manual (text book) that purports to explain the
kernel code (2.6.7 or greater) line-by-line, which mainly it does, but
it seems to remain silent on scanning and registering devices at
startup. Or, at least, I am misreading because I can't find it.

-- 
Regards Bill




More information about the users mailing list