Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to understand the Linux boot process, and after reading quite some amount of documentation there is one point that I still can't seem to understand.

So the basicis is BIOS -> Grub MBR -> Grub CONF -> Kernel ...

with a grub conf that can look like this

title CentOS (2.6.32-358.2.1.el6.i686)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-358.2.1.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-358.2.1.el6.i686.img 

So based on my understanding of the documentation + post I read, kernel will be loaded + mount initramfs as root filesystem. Then init will be executed which will be in charge to do a bunch of various stuff to get the system up and running.

My question is : How is the Kernel loaded?

I mean since the kernel is in /boot/vmlinuz-2.6.32-358.2.1.el6.i686 of my device (hd0,0) the filesystem needs to be mounted somehow first so it can be accessed.

If (what I suspect) Grub mounts hd0,0 partition does it do first a pivot_root with initramfs then another pivot_root with the actual root= fs specificied as kernel parameter ?

Any explanation / links that can help me understand a bit better how is this all working togetheris welcome,

share|improve this question
See unix.stackexchange.com/questions/58793/… or kernel.org/doc/Documentation/x86/boot.txt the kernel is just loaded into a specify memory region and gets executed –  Ulrich Dangel Mar 29 '13 at 12:55
"the filesystem needs to be mounted somehow first so it can be accessed" I don't know if "mounted" is the appropriate term, but grub obviously accesses and understands it. –  TAFKA 'goldilocks' Mar 29 '13 at 13:15
add comment

2 Answers

What grub does is to access /boot (read-only is enough, grub doesn't really need full filesystem handling here), and gets the relevant files from it. It loads the kernel and the initramfs into memory, and hands control over to the newly loaded kernel.

The newly loaded kernel then runs the init in the initramfs, which finishes off to finally pivot_root to /.

share|improve this answer
So Grub does mount the --boot-directory in order to load the Kernel ? –  Spredzy Mar 29 '13 at 13:02
@Spredzy, essentially yes. –  vonbrand Mar 29 '13 at 13:08
@Spredzy it doesn't mount it in the sense that the linux kernel does. It accesses it yes, but 'mount' as youre thinking of it is reserved for an operating system that has to deal with concurrent access. Since grub is the only thing accessing the filesystem at the time it's a lot simpler. –  Patrick Mar 29 '13 at 13:46
add comment

Grub has its own filesystem drivers. It doesn't use Linux's. Grub loads the kernel and initrd into memory according to the Linux kernel boot protocol. A part of the kernel is loaded at a predefined address, and Grub sets some parameters so that the kernel knows where to find the rest.

When the kernel boots, it mounts a root partition using its own drivers (which cannot be modules since there are no modules at that point). The root partition can be an initrd, an initramfs, or (in the absence of an initramfs or initrd) the block device indicated by the root command line argument (or a compiled-in default if there is no root argument).

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.