Results 1 to 4 of 4
Hello All,
I have a question on how the kernel knows the root directory. For example, in grub menu.lst file we specify root=/dev/hda1. This tells the kernel to find mount ...
- 03-26-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 9
How does kernel know the root directory?
Hello All,
I have a question on how the kernel knows the root directory. For example, in grub menu.lst file we specify root=/dev/hda1. This tells the kernel to find mount the root directory from /dev/hda1. But to read /dev/had1 it should first know where is '/' . I couldn't understand how this is being done. Could anybody please explain me?? Thank you....
Thanks,
Bala
- 03-26-2010 #2
Hi and Welcome !
It doesn't tell the kernel to find anything. It specifically inform kernel that /dev/hda1 is root filesystem. For mount points of other partitions/systems, if any, /etc/fstab file is default conf.For example, in grub menu.lst file we specify root=/dev/hda1. This tells the kernel to find mount the root directory from /dev/hda1.It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 03-26-2010 #3
I can't prove this, but because /dev is actually populated by the kernel (these are not actual files, but simply interfaces into the kernel), I would not be surprised if the kernel understands /dev/hda1 even before a root is chosen.
DISTRO=Arch
Registered Linux User #388732
- 03-26-2010 #4
When you install grub, it stores a device.map file that contains a mapping of partitions to /dev locations. For example, it could contain something like this:
(hd0) /dev/hda
(hd1) /dev/sda
So the file system rooted on hd0 is at /dev/hda and the file system rooted on hd1 is /dev/sda in this example. Then references to /dev/hda1 are mapped to the hd0 partition.
So its not a chicken and egg thing after all. The /dev labels are used in the device.map file to find the partition, but when you boot the kernel, it builds up its /dev directory and ensures it has the proper entries which ultimately will contain a /dev/hda1 but that is not known at grub boot time.
At least I think this is how it works. I could be wrong.


Reply With Quote