1

Basically, my problem was the /boot (/dev/sda1), which was a very tiny partition (88 Mo).

With the available VolumeGroup on this machine, I formatted a new LVM volume (600 Mo).

Then I copied the content of /boot/ to the new LVM partition (with cpio).

I made umount /boot , and some changes in Fstab to replace the old /boot partition.

Finally, I made update-grub to generate correctly a new grub.cfg. I rebooted, and it was already working. I was thinking that my new LVM partition was right, so with fdisk /dev/sda, I delete the /dev/sda1.

And now, I have the Grub Rescue at boot..

Even with Ubuntu livecd :

grub-install --modules='lvm' /dev/rootvg/bootlv

/usr/sbin/grub-probe: error: cannot find a device for /boot/grub/
No path or device is specified.


grub-install --modules='lvm' /dev/sda5

/usr/sbin/grub-probe: error: cannot find a device for /boot/grub/
No path or device is specified.

Same error...

Is there a solution to install the Grub bootloader on an existing LVM device ?

0

Maybe (i am a total new on lvm and grub) you need to install grub as this:

grub-install --modules='lvm' --boot-directory=/dev/rootvg/bootlv dev/sda

To put grub on MBR and use /dev/rootvg/bootlv as the /boot partition where grub files resides.

But if disk is GPT and you boot with BIOS you will need a special partition 1MiB to 8MiB of type BIOS_grub (without any format, it is a raw one for stage2 of grub).

I am having a lot of trouble to boot Grub2 from a [U]EFI with EFI partition and LVM, having the /boot partition inside a 3 stripes Raid0 LVM, but i can boot it normally if BIOS boot mode.

Partitions i have on each of three HDDs (all identical size, position, etc), in GPT stile: GPT1: LVM (Big one, rest of HDD space) GPT2: EFI (512MiB, FAT32) GPT3: bios_grub (8MiB, no format - RAW)

I create the vg on all /dev/sd[a-c]1 and inside LVM one partition for /boot

I mount /boot with: mount /dev/mapper/bla_bla_bla /boot

I create EFI mount point on it (not really needed but helps to type less letters on grub2-install)

I mount /dev/sda2 on /boot/efi

Then i add lvm to modules needed, with command:

echo GRUB_PRELOAD_MODULES=\"lvm\" >> /dev/default/grub

Then i install Grub2 with this command:

grub-install --target=i386-pc /dev/sda

And voila, unmount and reboot in BIOS mode and it boots Grub2.

Important, prior to unmount /boot edit /boot/grub/grub.cfg to fit what you need.

And please remember i am not booting an OS, i am only installing Grub2 inside a LVM partition and be able to boot.

Note: If i install with target x86_64-efi, it shows two messages and after it does not boot on [U]EFI mode correctly, LVM is not accessible.

P.D.: I got to the level of knownledge to create two different usb sticks that can boot in [U]EFI mode and in BIOS mode the SystemRescueCD.iso loop, but when i try to boot to Grub2 residing inside LVM i get problems if in [U]EFI mode... i am not an expert... i have been working on Grub2 and LVM, LUKS, etc... my intention is to create a very complex boot... three usb sticks in Raid0 LVM without /boot outside LVM and capable of boot on [U]EFI only PCs and on old BIOS only PCs, on mixed ones, etc... i am at the point where i can boot on both [U]FI and BIOS if /boot is outside LVM and on BIOS mode also with /boot inside LVM, but not on [U]EFI with /boot inside LVM.

P.P.D.: I am afraid it is a BUG on grub2*.efi that do not mount the LVM, so i recommend you to boot in BIOS mode... among this i had read some articles of ArchLinux telling it can be installed on LVM without /boot partition and having / inside LVM, but did not get step by step, nor i can reproduce that; and it is not my real objective, since i do not want a Linux installed, only Grub2... final real objetive is to have the Linux inside a big file that is inside a LVM partition that is inside a LUKS partitions that is on a LVM partition that uses three physical HDDs id raid0 mode (3 stripes), and boot from an USB having [U]EFI & Bios boot modes with Grub2 that chainload to Grub2 that is inside such Big file, and that Grub2 will load the kernel, initram, etc from inside such big file... etc; a plausible deny you have such Linux... if boot from HDD an encrypted Linux will be shown, where on its rootfs is the big file i mention, but if i boot from external usb stick if kowns how to boot the Linux inside that file... paranoid mode: the commands to do such chainload will be on my mind, not on USB stick, on the USB stick would only be a SystemRescueCD.iso loop boot, but instead of selecting to boot it, type c to go to grub console and type that commands to chainload to Linux inside the big file i mention... i know this is too, too much complex... but without having the trick of TrueCrypt/VeraCrypt that depending on the passphrase it mounts the dummy OS or the hidden OS, i have no other option, so i started some months ago with first steps... have a USB that boots on [U]EFI and on BIOS only PCs (done), having Grub2 inside a LVM (done for BIOS mode, error on [U]EFI mode), so many steps to walk left.

I hope my scheme and commands can help you to discover how to boot your system, or at least give you an option to search for.

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.