When the GRUB bootloader boots Linux, it pass the name of the root partition (where /sbin/init is) to the kernel through the root= kernel parameter in order for the initrd to be able to mount the real root filesystem later.

When we use the grub-install tool, we pass as arguments only the block device where the MBR should be installed and the place where the GRUB image and configuration files should be placed, we do not specify the root partirion with what the kernel will be booted.

How exactly GRUB determines the root partition of the system when it's installed? How is that implemented?

  • This is configured in grub.cfg. – DopeGhoti Dec 22 '16 at 21:25
  • Sure, but how it''s determined when it's done automatically by tools that install GRUB? – programings Dec 22 '16 at 21:28
  • 1
    Source code for grub-install is available at http://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-install.c – fpmurphy Dec 22 '16 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.