1

I want to know the exact location of grub boot loader inside HDD. I know grub-install /dev/sda to install grub but does that mean it install grub across whole HDD.?

  • 1
    No, only the boot sector is installed; the rest of grub are files. – Basile Starynkevitch Aug 22 '17 at 18:48
  • 4
    @BasileStarynkevitch That is not true. The boot sector is too small to contain file system code, so the "no man's land" between the boot sector and the first partition is typically used (on a BIOS/MBR system). – Johan Myréen Aug 22 '17 at 19:07
  • I think GRUB is using a "bootstrap sector" that loads the first stage. But as the first stage cannot be in a filesystem (the blocks need to be together, I guess) I think GRUB puts the first stage "between the partitions" somehow. Once you have more that one harddisk, I't really interesting to find out where the first stage actually is. Similar to the actual "boot sector". – U. Windl Mar 21 '19 at 10:01
4

The answer is: it depends. On a traditional MBR disk the first part (boot.img) is written to the boot sector, the next part usually in the sectors between the boot sector and the first partition. There is typically at least 63 sectors of unused space before the first partition. The rest of GRUB is stored in files in /boot/grub. On a GPT (GUID Partition Table) disk, but with a non-UEFI (=BIOS) firmware, a BIOS Boot Partition is used for storing the second part of GRUB. On a UEFI system, GRUB is loaded by the firmware from grubx64.efi on the ESP (EFI System Partition).

  • 1
    On 32-bit UEFI, GRUB is loaded by grubia32.efi, on 64-bit UEFI, GRUB is loaded by grubx64.efi – fpmurphy Aug 22 '17 at 20:19
  • Is there any command that can show the actual location of GRUB? Once I had managed to boot grub from Windows 7 boot manager, but recently I fail to find out where the actual GRUB boot sector really is. – U. Windl Mar 21 '19 at 10:04

Your Answer

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

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