You are not logged in.

#1 2015-04-10 09:44:46

andyspiros
Member
Registered: 2015-03-10
Posts: 19

Installing with lvm: where to put grub?

I'm installing on a brand new disk (/dev/sda). I have no other disks. I decided to go for the lvm option, and I did not use physical partitions: I created a single physical volume that fills the whole disk. I followed this note from the wiki:

Note: If using a SSD without partitioning it first, use pvcreate --dataalignment 1m /dev/sda

I set up happily my lvm logical volumes, mounted them, installed the base system and reached the point where I have to install a bootloader. Here I stopped and I felt quite stupid because I have no clue where to install grub. Installing it in /dev/sda is not an option since it is entirely used by the physical volume.

What is the correct procedure?

Last edited by andyspiros (2015-04-10 09:45:05)

Offline

#2 2015-04-10 09:50:40

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: Installing with lvm: where to put grub?

Doesn't grub go into /boot by default and overwrite the MBR (for BIOS systems)? In case of an UEFI system, you might not need grub at all.

Offline

#3 2015-04-10 10:03:23

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,605
Website

Re: Installing with lvm: where to put grub?

Install it to /dev/sda. It'll moan if it can't fit, in which case you may need to try a different bootloader, or repartition.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2015-04-10 10:05:35

andyspiros
Member
Registered: 2015-03-10
Posts: 19

Re: Installing with lvm: where to put grub?

To install grub into the MBR I need to have the MBR free. But the physical volume owns it completely. If I try and run

grub-install --recheck /dev/sda

I get the following error messages:

Installing for i386-pc platform.
    /run/lvm/lvmetad.socket: connect failed: No such file or directory
    WARNING: Failed to connect to lvmetad. Falling back to internal scanning
    /run/lvm/lvmetad.socket: connect failed: No such file or directory
    WARNING: Failed to connect to lvmetad. Falling back to internal scanning
    /run/lvm/lvmetad.socket: connect failed: No such file or directory
    WARNING: Failed to connect to lvmetad. Falling back to internal scanning
grub-install: error: unable to identify a fielsystem in hostdisk//dev/sda; satefy check can't be performed

Offline

#5 2015-04-10 15:41:57

SirMyztiq
Member
Registered: 2015-03-24
Posts: 118

Re: Installing with lvm: where to put grub?

Hello,

This might help:

/etc/default/grub
GRUB_PRELOAD_MODULES="lvm"
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="root=lvm/lvm_group_name-lvm_logical_boot_partition_name ..."

https://wiki.archlinux.org/index.php/GRUB#LVM

Offline

#6 2015-04-10 15:48:34

andyspiros
Member
Registered: 2015-03-10
Posts: 19

Re: Installing with lvm: where to put grub?

Thanks all for the help, I decided (for other reasons) to do without lvm.
For future reference, I am not sure that setting these variables in the /etc/default/grub file would solve the problem, because I think these are only used after installation, at the time of generating the configuration. But I might be totally wrong, I'm definitely not an expert.

Offline

#7 2015-04-10 16:47:34

SirMyztiq
Member
Registered: 2015-03-24
Posts: 118

Re: Installing with lvm: where to put grub?

andyspiros wrote:

Thanks all for the help, I decided (for other reasons) to do without lvm.
For future reference, I am not sure that setting these variables in the /etc/default/grub file would solve the problem, because I think these are only used after installation, at the time of generating the configuration. But I might be totally wrong, I'm definitely not an expert.

I know this is irrelevant now, but out of curiosity, did you not create a /boot LV in the VG inside the PG? You would then mount the "mapper-blah-blah" to /mnt/boot(after you mount "/") So that would be where you could install it.

Offline

#8 2015-04-14 10:00:09

andyspiros
Member
Registered: 2015-03-10
Posts: 19

Re: Installing with lvm: where to put grub?

I did not create a separate /boot LV. Anyway the question is not where to put the grub configuration, but where to install the boot loader so that the system can find it. Even if I had a separate /boot LV how would this help the booting procedure?

Offline

#9 2015-04-14 13:16:56

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,778
Website

Re: Installing with lvm: where to put grub?

andyspiros wrote:

where to install the boot loader so that the system can find it.

If you have a GPT type disk, you will need a BIOS boot partition to house the bootloader (type "ef02" in gdisk, no filesystem) on a non-EFI system.

Check by looking at the output of:

# parted -l

For systems using UEFI a separate /boot partition is needed (512MiB, FAT(32)-formatted, type "ef00" in gdisk); this will hold the bootloader and it's configuration files.

With an MBR disk in a non-EFI system the MBR is used (I think you could have just used `grub-install --force /dev/sda`).


Jin, Jîyan, Azadî

Offline

#10 2015-04-14 13:31:58

andyspiros
Member
Registered: 2015-03-10
Posts: 19

Re: Installing with lvm: where to put grub?

Head_on_a_Stick wrote:

With an MBR disk in a non-EFI system the MBR is used (I think you could have just used `grub-install --force /dev/sda`).

Are you sure? Even if my LVM physical volume across the whole /dev/sda? Wouldn't I risk overwrite some reserved parts? I does the LVM actual storage start anyway at an offset that allows for the MBR to be written before it?

In case of UEFI now it seems totally clear that using the whole disk for LVM is not an option (if this is your boot disk).

Offline

#11 2015-04-14 13:39:43

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,778
Website

Re: Installing with lvm: where to put grub?

andyspiros wrote:

Are you sure? Even if my LVM physical volume across the whole /dev/sda? Wouldn't I risk overwrite some reserved parts? I does the LVM actual storage start anyway at an offset that allows for the MBR to be written before it?

In case of UEFI now it seems totally clear that using the whole disk for LVM is not an option (if this is your boot disk).

Yes, I'm sure.

The MBR is not part of the filesystem.
https://en.wikipedia.org/wiki/Master_boot_record

With UEFI, LVM can be used as long as a separate EFI system partition is on the system (with /boot or /boot/efi mounted at that partition).


Jin, Jîyan, Azadî

Offline

#12 2015-04-14 13:43:02

andyspiros
Member
Registered: 2015-03-10
Posts: 19

Re: Installing with lvm: where to put grub?

Head_on_a_Stick wrote:

The MBR is not part of the filesystem.
https://en.wikipedia.org/wiki/Master_boot_record

Agreed, but isn't it part of the disk storage accessible through /dev/sda? Wouldn't I be able to read the MBR contents by using

dd if=/dev/sda bs=512 count=1

(or something similar)?
I'm not arguing, I'm a totally noob of the subject, I'm just trying to understand better.

Offline

#13 2015-04-14 13:51:39

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,778
Website

Re: Installing with lvm: where to put grub?

andyspiros wrote:
Head_on_a_Stick wrote:

The MBR is not part of the filesystem.
https://en.wikipedia.org/wiki/Master_boot_record

Agreed, but isn't it part of the disk storage accessible through /dev/sda? Wouldn't I be able to read the MBR contents by using

dd if=/dev/sda bs=512 count=1

(or something similar)?

Yes you can back up your MBR using a similar command but the filesystem itself (ie, the LVM storage area) starts after the MBR.


Jin, Jîyan, Azadî

Offline

Board footer

Powered by FluxBB