1

My understanding is that when I install GRUB, a primary OS loader gets written to the MBR and a secondary OS loader (the bulk of GRUB) gets written to some other partition. In normal operation, the primary OS loader in the MBR has enough information to transfer control to the secondary loader, which then reads all the partitions (primary and extended) and brings up the familiar GRUB menu.

In the past I have formatted a linux partition and ended up in GRUB rescue mode. Is the code which runs grub rescue located entirely within the MBR (I believe this is 'boot.img')?

1 Answer 1

1

The MBR gets written to sector 0 of the disk and is only 512 bytes long.

Nearly everything else boot-related in any Linux distro¹ is residing in /boot.

For a more extensive discussion on MBR boot, look at IBM's Linux: Into the boot process document.

¹ Any Linux distro to my knowledge...

8
  • It uses the "boot track" as well. If you look at fdisk you'll notice the first partition starts at sector 63... actually 2048 nowadays. So there's a few spare sectors after the MBR that grub uses to put more code. The MBR is too small on it's own, to contain a GRUB loader that can read the filesystem containing /boot.
    – sourcejedi
    Aug 22, 2015 at 19:44
  • Yup... I tried to keep it KISS, but I've tried to clarify things. @sourcejedi
    – Fabby
    Aug 22, 2015 at 20:51
  • My thought was, if the computer is able to reach /boot, why only load grub rescue rather than full grub? My hypothesis was that maybe MBR is large enough to house grub rescue, but not full grub. Am I wrong?
    – SauceCode
    Aug 22, 2015 at 21:58
  • As for the boot track, it's thought it was optional whether to put the remainder of grub (non MBR part) in the boot track or on another partition.
    – SauceCode
    Aug 22, 2015 at 22:03
  • @SauceCode: Those details are explained in IBM's document. ;-) If you like the answer, just click the little grey under the "0" now turning it into beautiful green. If you do not like the answer, click on the little grey down-arrow below the 0, and if you really like the answer, click on the little grey checkmark and the little up-arrow... If you have any further questions, just ask another one!
    – Fabby
    Aug 23, 2015 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .