4

I am installing Debian 9.9, I want this layout for my 1 TB hard disk with 8 GB Ram.

Size              Name / Mounted at
512 MB            EFI System Partition
40 GB             /
8GB               /swap
Remaining space   /home

On the internet people are using EFI partition mounted at /boot or /boot/efi.

Since Debian 9 does not allow /boot to be FAT32 so we can't use /boot. Would I be right in thinking that even /boot/efi is also not an option for the same reason?

Is there any reason to have /grub folder with GRUB2 in it ? Would it not install GRUB2 in the EFI System Partition on it's own ?

What are the benefits of the alternative partitioning schemes (viz. EFI in /boot, /boot/efi or GRUB2 installed in /grub ?

3
  • 1
    It sounds like you are confusing file-systems and paritions. /boot/efi does not need to be on the same partition as /boot. In a typical properly set-up Debian system, /boot will be a Linux standard filesystem (ext, xfs, etc.), and /boot/efi will be a separate partition formatted following the UEFI standard (a FAT based filesystem IIRC). I do not see any benefits from putting things in different locations. People with a lot more experience have figured out how to make this work already; why mess with that?
    – 0xSheepdog
    May 29, 2019 at 14:18
  • Dear 0xSheepdog,yes you are right. I was under the impression that /boot was of type ext4 while /boot/efi was of type FAT32 and that I could not mount the latter on the former. Thank you for clarifying that we CAN mount a FAT32 partition on a location in a ext4 partition. May 30, 2019 at 10:32
  • Yes, this can be a tricky topic. The "filesystem" describes how a block-device or storage-volume is organized. It is the specification of how the data is arranged, tracked, 'journaled', etc. Where a storage-volume is mounted is more or less irrelevant to what filesystem is in use on the volume. You can mount a volume many different places...it won't impact the filesystem-formatting at all, not in my experience (never say "never"...this is UNIX after all.)
    – 0xSheepdog
    May 30, 2019 at 14:19

1 Answer 1

6

The standard place (at least for Debian) for your EFI partition is /boot/efi. This can be and should be a FAT32 partition.

In a standard Debian Grub EFI layout, grub has three parts:

  1. /boot/efi
    Mounted EFI partition
    Contains stub grub bootloader and config
  2. /boot/grub
    Same partition /boot or /
    Contains grub modules and actual grub configuration
  3. /etc/grub.d
    Same partition as /
    Contains automatic configuration scripts

Grub does not install itself entirely on EFI, a significant proportion of it lives elsewhere. So to be able to boot you do still need /boot/grub. It only installs a stub and stub config to point itself to the rest. A typical EFI stub configuration looks like this (/boot/efi/EFI/debian/grub.cfg):

search.fs_uuid 2c675303-d207-4573-98f5-59a33c9890ab root hd0,gpt3
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

Notice how this config only tells grub where to find the real config (/boot/grub/grub.cfg located on hard disk 0 partition 3).

Also note that even though the configuration is primarily stored in /boot/grub, you never edit this manually, you ask grub script to edit it for you. And so to reconfigure grub (even just to add a new kernel) you also need /etc/grub.d. Note that scripts in this directory may be reliant on other libraries installed by Debian.


Therefore you must keep /boot/grub for two reasons:

  1. It contains your actual config and grub modules.
  2. So that the the automatic configuration scripts know where to write new config.

If you really want move /boot/grub onto EFI... (non-standard)

There's nothing actually stopping you. Just make sure that the scripts in /etc/grub.d know where to find it (eg: leave a symbolic link)

I've done this before for esoteric reasons. I run a system with an EFI partition containing two directories EFI and grub. I set this up with:

# Move /boot/grub onto my EFI partition
mv /boot/grub /boot/efi

# Leave a symbolic link from the old location to the new location
ln -s /boot/efi/grub /boot/grub

# Update the stub config /boot/efi/EFI/debian/grub.cfg to point to the new location
grub-install

# For safety update the contents of /boot/efi/grub aka /boot/grub
update-grub

I actually like this setup because it protects against the mistake I've seen several times here where people delete an OS and destroy grub and prevent any other OS from booting.


Reasons for partitioning

Partitioning has a number of purposes. With regards to partitioning parts of your boot loader, this is useful to handle different capabilities of various parts of your system.

  • Your BIOS can only read FAT based file systems
  • Grub has pretty good support for file systems but LVM and encrypted volumes can be a problem
  • Linux can read everything
  • Old Grub legacy could not read very large disks or partitions

Your BIOS needs to be able to load and run grub, so EFI needs to be on a FAT based file system.

Your master partition might be on something grub can't read, but grub needs access to your Kernel, Initramfs and it's own config, so /boot and /boot/grub need to be on a partition readable by grub. In the old days of grub legacy you also needed to ensure this partition was small enough and near the beginning of the drive on very small disks.

Linux can read everything, but you might want linux to run on an LVM or encrypted volume.

4
  • Dear Philip, I am a little confused. The layout in my query is what I want. I setup that layout using Manual partitioning. I think that the Debian installer automatically takes care of installing GRUB2 in the EFI partition. I don't have to do the steps suggested by you. Am I mistaken? What should I be reading? May 29, 2019 at 4:54
  • @user2338823 no you don't need to, its just a suggestion if you want to move /boot/grub onto your EFI partition. But you do need /boot/efi. May 29, 2019 at 14:09
  • Dear Philip, Appreciate your detailed reply. I have a request. Where can I read more about how the Debian installer works ? I am (a) using the Debian installer to create the sample layout in my original query. I think you are (b) first using a tool like gparted and then installing Debian. Where can I read in detail as to how to correctly do (a) and (b). May 30, 2019 at 10:27
  • You often don't use gparted first, in the install menu there's an option to manually lay out your system. The installer presents you with a very simple way to add / change partitions which will operate similar to gpated but with one addition: it automatically configures /etc/fstab which controls where partitions are mounted. You can google for further information on /etc/fstab. Likewise there's a gparted manual May 30, 2019 at 11:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .