7

Grub2 is able to load the kernel even if /boot is placed on an LVM volume. To use this feature one needs to add insmod lvm (the module can be on the grub bios partition that is not on an LVM volume) in the corresponding grub entry. But it doesn't explain to me how grub reads the kernel since the kernel should be loaded before anything can be inserted into it.

How does it work?

10

The insmod command in GRUB2 relates purely to GRUB modules and not to the kernel that it is loading. When you do insmod lvm, you are loading a GRUB module to enable it to read the LVM volume.

5

It has already been mentioned that the grub2 insmod command is not related to the kernel, but purely support modules for grub. This was perhaps a poor choice of keyword since it can cause confusion with kernel modules, but the two are unrelated.

How does grub2 access LVM without the kernel? LVM has a defined on-disk structure and contains metadata. Anything that can read a raw disk and knows how to interpret the LVM2 metadata to find a filesystem can fetch a file without needing a kernel. Once the lvm grub2 module has located the filesystem with the kernel, the kernel is loaded the same way as it would from a normal filesystem -- copied from the raw disk to memory, uncompressed and executed.

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.