Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How far does GRUB capability with LVM (device-mapper) go?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Fri May 26, 2023 4:07 pm    Post subject: How far does GRUB capability with LVM (device-mapper) go? Reply with quote

As many of you know there's a lot of different layers to lvm.
GRUB advertises a capability to load kernel from lvm, but does it work if I have created /boot by
Code:
lvcreate --type raid5 -i 3 --size <size> -n <lv_name> vg
... for example?

If it can't I need to put kernel and initrd into EFI partition. Otherwise I can have a separate /boot formatted with XFS and all the reflinking goodness. ;)
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1688

PostPosted: Fri May 26, 2023 5:07 pm    Post subject: Reply with quote

GRUB repository seems to indicate that LVM raid 1/4/5/6 are considered (as early as January 2012)

I have no idea if or how well it works. Would suggest light testing in a VM before applying to a real instance/machine.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Fri May 26, 2023 6:36 pm    Post subject: Thanks Reply with quote

grknight, thanks for the fast reply.
I guess I need to install qemu then.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Fri May 26, 2023 7:28 pm    Post subject: Reply with quote

Quote:
If it can't I need to put kernel and initrd into EFI partition. Otherwise I can have a separate /boot formatted with XFS and all the reflinking goodness. ;)

I think GRUB has full support for LVM, but there is little reason to use it on top of EFI:
There's nothing wrong with putting fat on boot partition and then not having a separate partition for /boot/efi. Also, refind is very simple to setup and does not require any maintenance at all. It just discovers all your kernels at boot time, and picks the one with the latest mtime. Press F2 for other options, touch an older kernel to make it default again.
No tricks with names or symlinks required, no need to regenerate configs etc. Just fire and forget, like a good loader should.

BTW, depending on how smart your mobo's efi is, you may find refind to be redundant too, and just boot directly instead. Refind is optional, but it would provide flexibility you might need once a blue moon, and shield you from bad EFI implementations.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Fri May 26, 2023 8:08 pm    Post subject: Reply with quote

szatox,

I use refind on almost all of my systems. And I really don't like autogenerating grub configs, in fact it completely missed my custom initrd while refind found it. And also on my usual setups my /boot is on fat.
But grub has more features and I've been planning to create much more simple grub script (config) by hand. I just need to get more familiar with it.
With scripting I can customize grub as much as I like. Debatable if I really need more customization for EFI/bootloader... But hey, this is Gentoo. ;)
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1549
Location: South America

PostPosted: Fri May 26, 2023 8:58 pm    Post subject: Reply with quote

grknight wrote:
GRUB repository seems to indicate that LVM raid 1/4/5/6 are considered (as early as January 2012)

I have no idea if or how well it works.

sys-boot/grub-2.06-r6 seems to be able to read from LVs of type raid5 for me, so I suppose it should be able to boot from them, too:

On Gentoo:
Code:
# lvs -o name,lv_layout vg_test
  LV       Layout             
  RaidTest raid,raid5,raid5_ls


On GRUB, after dropping to the CLI from the menu with c:

Code:
grub> insmod lvm

grub> ls (lvm/vg_test-RaidTest)/
lost+found/ dir1/ dir2/

grub> ls (lvm/vg_test-RaidTest)/dir1
file1

grub> cat (lvm/vg_test-RaidTest)/dir1/file1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Fri May 26, 2023 10:51 pm    Post subject: Reply with quote

Zucca wrote:
szatox,
[..]
With scripting I can customize grub as much as I like. Debatable if I really need more customization for EFI/bootloader... But hey, this is Gentoo. ;)

I see. Well, I'm not one to take your hobby from you.
However, it does sound so absurd you actually got me curious now. What are you trying to do there?
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Sat May 27, 2023 6:13 am    Post subject: Reply with quote

szatox wrote:
However, it does sound so absurd you actually got me curious now. What are you trying to do there?
My long time plan has been to simplify grub configuration creation (since grub2 was released, I've been using refind because in my eyes grub config creation is a big mess). Make one static config (script) that resides on EFI partition. Optionally (probably required) is another config file which contains settings like
Code:
root=UUID=BEEF
rootfsflags=ro,noatime
which is then sourced by the main grub config. The settings file would be the single and only file to be edited (or automatically generated).
I hope that this kind of setup is possible.

The grub lvm support is just another nice-to-have feature, not really related to my plans.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3151

PostPosted: Sat May 27, 2023 8:58 am    Post subject: Reply with quote

So, basically you want to make grub operate like refind with extra steps.
Well, it should be doable, grub does support includes and variables, so probably not even that difficult to configure, but at the same it might to be quite fragile, since you'd be doing that thing called "not-what-the-authors-expected".

Do you have any particular use case that needs such custom setup, or doing this just for fun and challenge?
Or maybe you made a bet or something? :lol:
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Sat May 27, 2023 3:58 pm    Post subject: Reply with quote

Well. There's the "learning to grub" -part and with that I could make some my custom usb live sticks.
But mostly because I have always thought that creating complex script with a bunch of scripts is somewhat mad.
"There's got to be a simpler way" is what drove me to this.

Normally I'd use refind... and I do. It's far simpler and better with "normal setups" than grub.

I also wrote my own initrd creation tool... so yeah.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum