[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mdadm grub install problem



Thanks for the detail Pascal.


On Tue, Sep 15, 2015 at 2:00 AM, Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:
Muhammad Yousuf Khan a écrit :
> command "grub-install --modules=part_gpt /dev/sdc" resolved the issue for
> me.

Glad to hear it.

> however i also wanted to know that how it actually works.
> what is the difference. i can understand i am mentioning gpt module in
> the command but what is the theoretical story behind this to work. or
> what is the difference b/w grub-install /dev/sdc and grub-install
> --modules=part_gpt /dev/sdc

A typical GRUB boot loader comes in 2 or 3 parts :
1) A "boot image" installed in the boot sector of a disk (MBR) or a
partition (PBR). Not used for EFI boot.
2) A "core image" installed either in a special place outside a
filesystem (gap between the MBR and 1st partition in a MSDOS format
disk, BIOS boot partition in a GPT format disk) or as a regular file in
a filesystem, /boot/grub/core.img or /boot/grub/i386-pc/core.img for PC
BIOS, or /boot/efi/EFI/debian/grubx64.efi for UEFI.
3) Various files in /boot/grub/, including the config file grub.cfg and
modules.

The BIOS firmware loads the boot image which loads the core image, or
the EFI firmware loads directly the core image. Then the core image
reads files in /boot/grub to display the boot menu, then reads files in
/boot/grub and other locations to boot the selected entry.

The boot image uses block lists to load the core image, so it does not
have to understand partition tables, filesystems or whatever. But the
core image read files, so it has to understand the filesystem, partition
table, RAID array or LVM volume these files reside in. GRUB modules are
just like Linux kernel modules : they provide loadable capabilities to
the core image (~ GRUB kernel) to read filesystems such as ext2/3/4,
btrfs, NTFS, FAT, containers such as LVM or RAID, partition tables such
as GPT or MSDOS and so on. The purpose of this modular design is to keep
the core image small, otherwise it may not fit into the post-MBR gap
(previously 31 KiB, now 1 MiB). But modules are files, and the core
image must be able to load them before it can use their capabilities. So
the required modules to read files in /boot/grub must be embedded into
the core image. grub-install is supposed to auto-detect all needed
modules and include them when building the core image. However, it seems
that in your case it didn't. Maybe it was confused by the presence of
both MSDOS and GPT partition tables. The --modules option instructed
grub-install to include the module providing the missing capability to
read GPT partition tables.



Reply to: