help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple btrfs root subvolumes?


From: Andrei Borzenkov
Subject: Re: Multiple btrfs root subvolumes?
Date: Fri, 9 Apr 2021 20:55:57 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 09.04.2021 08:02, Justin Vallon wrote:
> I am wondering whether Grub2 has any btrfs support for multiple root
> subvolumes.  It appears it might be able to handle writing a grub.cfg
> that would reboot into the current root partition if the partition is
> btrfs (though, not sure).
> 

grub does not care about filesystem content at all. It only needs to
know location of kernel (and possibly initrd) and kernel options. How
kernel finds its root is entirely up to this kernel.

> The grub-mkconfig code seems confused by btrfs:
> 
> 1) It assumes a device has a single filesystem

btrfs *is* single filesystem.

> 2) It steps through devices, then maps device to mount point

I am not sure what you mean here, but grub needs to resolve file
location on btrfs to the absolute path so it can access it during boot.
No mount points are present during bootloader phase.

> 3) 30_os-prober has some code for btrfs from os-prober output, but I
> don't see where os-prober will generate such entries
> 

os-prober is not part of grub. It was mistake to carry it in grub
sources in the first place.

The code you talk about was added 8 years ago, probably to support some
os-prober patch available in some distribution at this time. Those
distributions that attempt to support boot from subvolumes include
custom, often incompatible, patches to os-prober. There is no real
upstream for os-prober anyway and for all I can tell it is failed
attempt to multiboot linux.

> It would be nice if it would be able to generate a grub.cfg that could
> boot into any subvolume that was bootable:

Define "bootable subvolume".

> 
> 1) Recognize btrfs filesystem
> 2) Temp mount subvol=. if not already mounted
> 3) Run os-detector on each subvol
> 

That is more or less what os-prober in openSUSE does.

> Does this not work?
> 

I am not sure what you are asking. Does it work now? It depends on what
your distribution provides. Does it work with upstream os-prober? There
is no real upstream for os-prober, the closest is Debian and as you
probably have seen this version does not handle subvolumes. Is it
possible to implement it? Probably, the proof of pudding is in eating.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]