Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Need guidance about efi partition.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 46

PostPosted: Fri Apr 26, 2024 10:57 am    Post subject: [Solved] Need guidance about efi partition. Reply with quote

hi,
I am facing an ambiguity and want to learn about (UEFI systems) /efi and /boot/efi ,
So installing Gentoo for a laptop corei7 9th Generation what is the best practice for efi setup in partition ?

If I follow Gentoo handbook https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base#Preparing_for_a_bootloader here it shows

Code:
root #mkdir /efi # May have been created in a previous step
root #mount /dev/sda1 /efi


but in some web sites there are steps how to setup the partitions for Gentoo in which they creates separate /efi partition with fat32 and separate /boot/efi using ext4

Code:
 
/dev/ sad1   100Mb       # For /dev/sda2 /boot/efi
/dev/sda2    1G             # For /boot
/dev/sda3     /           
/dev/sda4     /home


mkdir /boot/efi
mount /dev/sda1 /boot/efi
mount /dev/sda2 /boot


What is the logic behind it to create a separate /boot/efi and separate /boot partition ? The thing I understand is if a user need multiple operating systems then he/she may adopt separate /boot/efi and separate /boot partition. In my case I only want to install Gentoo Linux so mount /dev/sda1 /efi with size of 1G is sufficient ?
Rest partitions should be "swap"and "/ " partitions.


Last edited by gardenair on Sat Apr 27, 2024 4:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4216
Location: Bavaria

PostPosted: Fri Apr 26, 2024 12:25 pm    Post subject: Reply with quote

gardenair,

you will need only one ESP (efi system partition). This partition must be formatted with a FAT variant (recommended FAT32). Before September 2023 this partition was mounted to /boot. Then it was changed und a new mountpoint was created: /efi ... Today you mount your ESP to /efi and install according to our handbook. /boot/efi ist outdated ... dont use it.

See more here:
https://wiki.gentoo.org/wiki/User:Pietinger/Draft/Quick_Installation_OpenRC_for_an_UEFI_System

In this article you will get an overview about UEFI booting (dont use it; it is only for a manual configured kernel): read only chapter: "Prerequisites for an UEFI boot"
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI
In this article you will find also a link to:
https://forums.gentoo.org/viewtopic-t-1165115-highlight-.html
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1579

PostPosted: Fri Apr 26, 2024 1:20 pm    Post subject: Re: Need guidance about efi partition. Reply with quote

gardenair wrote:

but in some web sites there are steps how to setup the partitions for Gentoo


For Gentoo, follow only the official Gentoo documentation, namely the Handbook and the Wiki pages.

You can also use the forums (obviously) and IRC.

Using outside resources may bring confusion. Use outside resources only when you know what you're doing and Gentoo or other distribution specifics won't bother you.

Best Regards,
Georgi
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54289
Location: 56N 3W

PostPosted: Fri Apr 26, 2024 4:03 pm    Post subject: Reply with quote

gardenair,

Mount points and partitions are fairly separate but related concepts.
In what follows they are not related at all.

First some definitions
Partitions exist on block storage devices.
Mount points are locations in the kernel filesystem tree where filesystems, often but not always, contained an partitions may be mounted.
Mount points only exist after the kernel has started. That's important. The EFI firmware has no concept of mount points. It does not need one.

When the EFI firmware starts it does some checks then reads the partition table to find the EFI System Partition.
You may have several EFI System Partitions but don't. It will make your head hurt.
From the ./EFI directory in the EFI System Partition, the EFI firmware will load an EFI compliant program.
That can be anything. An EFI stub kernel, a boot loader ... whatever.
The firmware does this all on its own. The kernel is not yet leaded so there are no mount points yet.

Whatever gets loaded, it has to bring up the system all on its own. Calls to the EFI FIrmware are possible, but its the EFI compliant program in RAM in control.

Lets say that its a boot loader like grub.
Grub will load the rest of itself and show a menu which you interact with to load the kernel and initrd of your choosing.
There is still no filesystem tree yet.

When the kernel starts, it is told where to find the root of the filesystem tree with root=... on the kernel command line.
Once root is mounted the filesystem tree and mount points begin to exist.
The localmount service attaches more filesystems (not partitions) to the tree.

Several things follow from this.
1. The EFI System Partition need only ever mounted in the kernel filesystem tree when its contents need to be changed.
2. As long as you know where it is, it can be a different place every time.
3. The concept of a location in the kernel filesystem tree for the EFI System Partition is only a user convenience. Its the user that maintains the mapping, The system does not mind, hence my opening
Quote:
In what follows they are not related at all.


The PC Boot Process may help.
In documents like the handbook, a fixed location is required for ease of reference.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 375

PostPosted: Fri Apr 26, 2024 5:09 pm    Post subject: Reply with quote

The ESP is always a FAT formatted partition.

Whether you mount it to /efi or /boot/efi is your choice. If you choose Grub as a bootloader then about 99% of the guides in the internet are expecting the ESP mounted to /boot/efi (, because this is the Grub-default). If you follow the Gentoo way and you like to blindly follow instructions, you will use /efi as mountpoint (and you have to remember that you mounted the ESP to /efi and not /boot/efi). If you follow the Gentoo way and you know, what you are doing, then you can do what you want.

Using either /efi or /boot/efi, you do not need a separate /boot-partition. But if you have a separate /boot-partition and you choose /boot/efi as mountpoint for the ESP, then you need to mount first /boot and afterwards /boot/efi (you have a nested mounts and the order is important).
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 46

PostPosted: Fri Apr 26, 2024 5:10 pm    Post subject: Reply with quote

Thanks all for the detailed reply. Appreciate it. The topic is itself a book.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing 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