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.?
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).