View previous topic :: View next topic |
Author |
Message |
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Fri Mar 23, 2018 10:43 am Post subject: Moving to UEFI -- rEFInd [DONE] |
|
|
After recent hard drive failure I decided to re-arrange my filesystem layouts on the disks. I also decided to switch to UEFI to overcome the 2TiB limit of a partition. It, however, poses a problem: FAT filesystem is a requirement.
Nearly all my data on my home server is on five hotswappable disks. My plan is to lay btrfs on each disk without partitioning and partition table. Raw btrfs. But becuase UEFI I need to have seperate disk(s) for booting.
Question is can I put /boot on a btrfs subvolume on that five disk btrfs pool (I can set it as default subvolume, so that when mounted without any special arguments the /boot subvolume is then accessed), and format a seperate disk for UEFI use only. Can grub (for example) boot from btrfs-raid setups? Currently I use btrfs-raid1, but when the time comes, I'll propably switch to raid5, 6 or 10.
EDIT: Changed topic name to reflect the current state of this topic. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
Last edited by Zucca on Tue Apr 24, 2018 1:51 pm; edited 3 times in total |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Fri Mar 23, 2018 11:18 am Post subject: |
|
|
Your answer is simple if you ask the question differently : does UEFI bios knows what btrfs is?
I think you know the answer. |
|
Back to top |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Fri Mar 23, 2018 11:22 am Post subject: |
|
|
Hi,
UEFI needs a GPT partitionned disk, with a FAT32, EF00 labelled partition _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Fri Mar 23, 2018 2:26 pm Post subject: Re: Moving to UEFI :( |
|
|
Zucca wrote: | It, however, poses a problem: FAT filesystem is a requirement. | Yes. I know the FATfs requirement.
The question is: Can GRUB2, for example, boot (load kernel) from my five disk btrfs-raid pool, or do I need to place /boot into some seperate disk (like I need to do with UEFI FAT partition)? _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Mr. T. Guru
Joined: 26 Dec 2016 Posts: 477
|
Posted: Fri Mar 23, 2018 2:32 pm Post subject: |
|
|
The computer must loads your bootloader, then, I believe the boot process doesn't rely anymore on the underlying UEFI plateform.
The kernel controls hardware after the boot, doesn't it?
UEFI specification, p18 wrote: | If the UEFI OS loader successfully loads its operating system, it can take control of the system by
using the Boot Service EFI_BOOT_SERVICES.ExitBootServices(). After successfully calling
ExitBootServices(), all boot services in the system are terminated, including memory
management, and the UEFI OS loader is responsible for the continued operation of the system. |
UEFI specification, p18 wrote: | The purpose of the UEFI interfaces is to define a common boot environment abstraction for use by loaded UEFI images[...].
The goal of this set of abstracted platform calls is to allow the platform and OS to evolve and innovate independently of one another.
Also, a standard set of primitive runtime services may be used by operating systems |
UEFI specification, 19 wrote: | The primary purpose of the runtime services is to abstract minor parts of the hardware implementation of the platform from the OS. |
GRUB may be a UEFI OS loader.
UEFI specification, p15 wrote: | UEFI supports booting from media that contain an UEFI OS loader or an UEFI-defined System
Partition. An UEFI-defined System Partition is required by UEFI to boot from a block device. |
helecho |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Fri Mar 23, 2018 3:09 pm Post subject: |
|
|
It still doesn't answer my question.
Sure I can have GRUB being loaded by UEFI from the UEFI FAT partition. That's a nobrainer.. But can GRUB load kernel from /boot which is a btrfs subvolume on a btrfs-raid? Or do I need to place /boot into a seperate disk/partition? I'd like to have everything on my btrfs pool, but I know at least the UEFI partition needs to be FAT.
If GRUB cannot, I might use the UEFI partition also as /boot. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
Last edited by Zucca on Tue Apr 17, 2018 8:12 pm; edited 1 time in total |
|
Back to top |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Fri Mar 23, 2018 3:11 pm Post subject: |
|
|
Only the bootloader needs to be in the EFI partition. If it recognizes your /boot partition, it's OK.
You can use any bootloader, or put your EFI-enabled vmlinuz in the EFI partition (no bootloader needed) and create an entry with efivars. _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Fri Mar 23, 2018 3:18 pm Post subject: |
|
|
I thought about efistub before, but for other reasons I'd like to have bootloader to load the kernel. Preferably GRUB2 because I might need its scripting features later. If it can load kernel from btrfs-raid /boot I'll proceed with rearraging my partitions. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Mr. T. Guru
Joined: 26 Dec 2016 Posts: 477
|
Posted: Fri Mar 23, 2018 3:23 pm Post subject: |
|
|
boot is eventually a mount point giving access to the boot partition. The most important to consider is not the mountpoint but the boot partition.
An UEFI platform can load a UEFI application (e.g. UEFI OS loader) located on an (U)EFI System Partition (ESP). The bootloader must load the kernel
and the initramfs. You can put your kernel and initramfs on the ESP.
Edit: I had some confusion.
Last edited by Mr. T. on Fri Mar 23, 2018 3:48 pm; edited 4 times in total |
|
Back to top |
|
|
skellr l33t
Joined: 18 Jun 2005 Posts: 975 Location: The Village, Portmeirion
|
Posted: Fri Mar 23, 2018 3:35 pm Post subject: |
|
|
Since it's not software raid nor hardware raid and you can initialize the array with only mount options, i'd say yes. You'd only need an efi stub kernel with mount options compiled in the kernel. Even forgo a boot loader like xaviermiller mentioned.
I don't have experience with btrfs-raid but only btrfs, pleas excuse me for talking out of my ass, but I don't see why not. Take one for the team and let us know. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Fri Mar 23, 2018 3:58 pm Post subject: |
|
|
skellr wrote: | I don't have experience with btrfs-raid but only btrfs, pleas excuse me for talking out of my ass, but I don't see why not. Take one for the team and let us know. | I think I'll use some USB memory stick as my test platform. I install GRUB there on the UEFI FAT partition. Then I'll create a temporary btrfs subvolume on my current btrfs pool and place kernel there. I just done give root partition information for the kernel, since I know kernel can access btrfs just fine (meaning the efistub will work). If the kernel then gets loaded by GRUB and it errors out by not finding rootfs (because I haven't given it for the kernel) it means that GRUB actually can load kernel from btrfs-raid.
So. I'm taking one for the team. But first I'll ask from #btrfs and from #grub (if one exists) if someone knows it's impossible. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
Last edited by Zucca on Tue Apr 17, 2018 8:14 pm; edited 1 time in total |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Sat Mar 24, 2018 9:01 am Post subject: |
|
|
I got more confirmation. GRUB2 should be albe to cope with any btrfs filesystem data layout just fine. So having /boot as a btrfs subvolume should work out-of-the-box. If I encounter problems I can easily just move the files from the subvolme to a regular disk partition on the same boot disk where I have the UEFI FAT partition. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Mar 24, 2018 9:14 am Post subject: |
|
|
Your question's not really anything to do with EFI. GRUB is GRUB, it can load from Btrfs and I guess with it being a kitchen sink it might know how to load a kernel off of a Btrfs RAID. That's one fairly complex moving part though and you'll still need the usual initramfs nonsense to get the kernel to mount a Btrfs RAID rootfs either way. |
|
Back to top |
|
|
Mr. T. Guru
Joined: 26 Dec 2016 Posts: 477
|
Posted: Sat Mar 24, 2018 9:23 am Post subject: |
|
|
EFI System Partition (ESP) is the boot partition and is mandatory so the easiest solution is to put kernel and initramfs on this partition. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Sat Mar 24, 2018 10:08 am Post subject: |
|
|
Ant P. wrote: | Your question's not really anything to do with EFI. GRUB is GRUB, it can load from Btrfs and I guess with it being a kitchen sink it might know how to load a kernel off of a Btrfs RAID. | At first my question was if any UEFI compatible bootloader/OS loader was able to load kernel from my btrfs setup. Why I mentioned GRUB is because I think I'll utilize its scripting cabability later on. While my opinion is that shell scripts creating grub scripts is a overengineered, it may pose some advantages. It remains to be seen if the advantages are worth the complicated set of scripts.
helecho wrote: | EFI System Partition (ESP) is the boot partition and is mandatory so the easiest solution is to put kernel and initramfs on this partition. | Well, it becomes boot partition if you put kernel there. Traditionally boot partition is the one with kernel. But when (U)EFI came it has been possible to combine the ESP and the traditional boot partition.
I may put kernel and initramfs there if things get too complicated. But as stated before at least GRUB can load kernel from multi-device btrfs. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Sat Mar 24, 2018 12:15 pm Post subject: |
|
|
Zucca wrote: | I may put kernel and initramfs there if things get too complicated. | ... and things probably will get complicated if I need to boot the system using degraded btrfs.
Even if I could avoid initrd by giving kernel root=device=/dev/sda,device=/devsdb,device=/dev/sdc it would certainly fail if I had already dropped a drive from the btrfs-pool.
I'll place kernel and initrd on seperate /boot partition and GRUB on /boot/efi/EFI or similar which will be the ESP of course. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21624
|
Posted: Sat Mar 24, 2018 4:01 pm Post subject: |
|
|
You should be able to put the kernel and initramfs in the ESP with grub. As you say, grub reads a variety of filesystem types, so this sequence should work:- Firmware loads EFI-enabled grub from EFI System Partition, which is necessarily FAT due to the limited functionality of most UEFI firmware.
- EFI-enabled grub loads kernel and initramfs from EFI System Partition, which should work since Grub can read FAT and ESP is FAT.
- Initramfs guides kernel through mounting/booting any filesystem that full Linux can handle, since this stage is a full Linux kernel.
This lets you have only the EFI System Partition separate from your btrfs/raid/etc. setup, rather than requiring one filesystem for ESP, another for kernel+initramfs, and another for the "real" system. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Sat Mar 24, 2018 4:46 pm Post subject: |
|
|
I can later migrate /boot with ESP, but for now I keep kernel+initrd on seperate partition. I want to utilize FAT as little as possible. It's just my own preference. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Mar 24, 2018 8:45 pm Post subject: |
|
|
Zucca wrote: | Even if I could avoid initrd by giving kernel root=device=/dev/sda,device=/dev/sdb,device=/dev/sdc it would certainly fail if I had already dropped a drive from the btrfs-pool. |
Wait, does that actually work? I tried to set up a Btrfs RAID a few years back and couldn't figure out how to get it to boot directly, their wiki didn't mention this syntax at all. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Sat Mar 24, 2018 9:04 pm Post subject: |
|
|
It was mentioned on #btrfs@freenode by someone, so it remains to be tested. I do have some doubts but since the driver in in kernel, technically it should work.
EDIT: I found more. It seems it should really work from kernel command line also. I don't see any reason why it wouldn't.
The problem comes then with degraded arrays. Will it work then? _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sun Mar 25, 2018 1:50 am Post subject: |
|
|
Wouldn't that just need rootflags=degraded on the kernel line? |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3343 Location: Rasi, Finland
|
Posted: Sun Mar 25, 2018 11:56 am Post subject: |
|
|
Ant P. wrote: | Wouldn't that just need rootflags=degraded on the kernel line? | Yes. Indeed. I had a small brainfreeze there.
But can GRUB (or any other cabable OS/bootloader) load kernel from degraded array? Is it possible to tell grub that the /boot is in degraded state? This, however, can be circumvented just by placing kernel into ESP or somewhere outside the btrfs array.
Dropping initrd out isn't a high priority for me, but if it is this easy I might as well do it. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
skellr l33t
Joined: 18 Jun 2005 Posts: 975 Location: The Village, Portmeirion
|
Posted: Sun Mar 25, 2018 5:19 pm Post subject: |
|
|
I think you can get away with only specifying a single device that is part of the array and btrfs will figure it out, unlike an md array. Something to test while you're at it. That would be nice! |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sun Mar 25, 2018 6:53 pm Post subject: |
|
|
helecho wrote: | You can put your kernel and initramfs on the ESP |
You can but you don't have to. You only need the boot loader on the ESP. IMHO, it's best to put as little as possible on FAT.
Code: | # grep /dev/sda /etc/fstab
/dev/sda1 /boot/efi vfat auto,noatime 1 2
/dev/sda2 / ext4 defaults,noatime 0 1
|
|
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sun Mar 25, 2018 7:10 pm Post subject: |
|
|
skellr wrote: | I think you can get away with only specifying a single device that is part of the array and btrfs will figure it out, unlike an md array. Something to test while you're at it. That would be nice! |
That's what the docs told me, and I didn't have much success back then. I spent hours stumbling blindly around the web in search of an answer and came across a (very small) kernel patch that would've made it work without initramfs. Has that been merged yet? |
|
Back to top |
|
|
|