Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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