Difference between installing GRUB on MBR sector or first sector on boot partition?
The MBR is used by the BIOS to load and start code from the harddisk. If you don't write anything to MBR, it will be empty and the BIOS will (usually) notify you that no operating system has been found.
This is why all operating systems write their boot code into the MBR to make sure that the user gets a bootable harddisk and can start the installed operating system. It gets interesting when you have multiple operating systems. Only one operating system can write the MBR during installation. The previous one will be overwritten and its boot code is lost.
GRUB is not only located in MBR but contains boot code that loads from a bootable partition (which partition it is depends typically from which operating system you have installed grub). Grub is also called a "boot manager", because it is able to start more than just one operating system.
If you write the boot code to the boot partition (in contrast to MBR) then this code can be started if the boot code in MBR is able to do chain loading. This is also the preferred technique, in case when GRUB does not know how to handle the operating system. It just loads the boot code from the other (native) boot loader and executes it. When grub itself knows how to start the system, it does not need to use chain loading.
Related videos on Youtube
Akheel Asadi
Storage Support Engineer(EMC CLARiiON storage array)..Level 3 Engineer for HW support(Servers,Storage arrays,mellanox switches)
Updated on September 18, 2022Comments
-
Akheel Asadi over 1 year
Kickstart gives two options to install the GRUB bootloader either on "MBR" or "first sector of /boot partition".
If we choose to install it on /boot partition then what would 512 bytes of MBR contain?
-
jc__ over 7 yearsSo what is the difference between
grub-install /dev/sda
andgrub-install /dev/sda1
? -
Martin Sugioarto over 7 yearsThe first one is writing boot code to the MBR. The second is writing the boot code to the first (primary) partition and will only work when you already have some other boot code in the MBR.
-
Martin Sugioarto over 7 yearsIt can always be installed where you want it, but it is difficult to start a system when it won't boot automatically. For trivial scenarios (and you probably want to have a trivial boot process) you would like yo have some boot code in MBR. But don't forget that you can also make a system boot using external drives and then forward the boot manager to boot other devices.