• EFI system partition

    From Tommy Berglund@21:1/5 to All on Sat May 24 15:50:01 2025
    Hi,
    Translated by Google from Swedish

    Is it possible to add an EFI system partition to a server already
    running Debian 12?
    How do I do it?

    (parted) print devices
    /dev/sda (2000GB)
    /dev/sdb (2000GB)
    /dev/mapper/vg-data (1888GB)
    /dev/mapper/vg-www (4295MB)
    /dev/mapper/vg-vmail (10,7GB)
    /dev/mapper/vg-ftp (16,1GB)
    /dev/mapper/vg-var (9999MB)
    /dev/mapper/vg-tmp (1996MB)
    /dev/mapper/vg-home (43,1GB)
    /dev/mapper/vg-root (25,0GB)
    /dev/mapper/vg-swap_1 (1023MB)
    (parted) print free
    Model: ATA ST2000VN000-1H31 (scsi)
    Disk /dev/sda: 2000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags:

    Number Start End Size Type File system Flags
    1024B 1049kB 1048kB Free Space
    1 1049kB 512MB 511MB primary ext2 boot
    512MB 513MB 1048kB Free Space
    2 513MB 2000GB 2000GB extended
    5 513MB 2000GB 2000GB logical lvm
    2000GB 2000GB 90,1kB Free Space

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joe@21:1/5 to Tommy Berglund on Sat May 24 19:50:01 2025
    On Sat, 24 May 2025 15:31:03 +0200
    Tommy Berglund <tommy@fam-berglund.eu> wrote:

    Hi,
    Translated by Google from Swedish

    Is it possible to add an EFI system partition to a server already
    running Debian 12?
    How do I do it?

    (parted) print devices
    /dev/sda (2000GB)
    /dev/sdb (2000GB)
    /dev/mapper/vg-data (1888GB)
    /dev/mapper/vg-www (4295MB)
    /dev/mapper/vg-vmail (10,7GB)
    /dev/mapper/vg-ftp (16,1GB)
    /dev/mapper/vg-var (9999MB)
    /dev/mapper/vg-tmp (1996MB)
    /dev/mapper/vg-home (43,1GB)
    /dev/mapper/vg-root (25,0GB)
    /dev/mapper/vg-swap_1 (1023MB)
    (parted) print free
    Model: ATA ST2000VN000-1H31 (scsi)
    Disk /dev/sda: 2000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags:

    Number Start End Size Type File system Flags
    1024B 1049kB 1048kB Free Space
    1 1049kB 512MB 511MB primary ext2 boot
    512MB 513MB 1048kB Free Space
    2 513MB 2000GB 2000GB extended
    5 513MB 2000GB 2000GB logical lvm
    2000GB 2000GB 90,1kB Free Space


    Looks like you need to shrink lvm a bit. EFI needs a partition
    formatted to one of the FAT family filesystems, with no additional
    software needed to access it, so no encryption or LVM. The size
    recommendation for Linux is 1GB minimum. It's generally advised to keep
    it near the beginning of large discs.

    --
    Joe

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Smith@21:1/5 to Tommy Berglund on Sat May 24 20:10:02 2025
    Hi,

    On Sat, May 24, 2025 at 03:31:03PM +0200, Tommy Berglund wrote:
    Is it possible to add an EFI system partition to a server already
    running Debian 12?

    The other reply you got covers making an ESP partition, but your main
    problem is going to be that you also need to install grub in EFI mode
    WHILE BOOTED IN EFI MODE. Right now you will be booted using legacy BIOS
    mode.

    So, you're going to have to

    - Reboot and get into the BIOS/firmware of your machine to set it to
    UEFI boot mode

    - Boot a live/rescue environment such as any recent Linux live media, or
    the rescue mode of any Debian install media

    - Reinstall grub as it says here: https://wiki.debian.org/GrubEFIReinstall

    Myself, I'd be asking what the purpose is of doing all this. If running
    in legacy BIOS mode is working then it is going to continue working. I
    would not change it until/unless the whole operating system is
    reinstalled next time.

    Some storsage devices such as NVMe drives are not bootable in legacy
    BIOS mode, but it looks like you have a working operating system already
    so maybe that's not why you are wanting to do this.

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Christensen@21:1/5 to Tommy Berglund on Sun May 25 06:50:01 2025
    On 5/24/25 06:31, Tommy Berglund wrote:
    Hi,
    Translated by Google from Swedish

    Is it possible to add an EFI system partition to a server already
    running Debian 12?
    How do I do it?

    (parted) print devices
    /dev/sda (2000GB)
    /dev/sdb (2000GB)
    /dev/mapper/vg-data (1888GB)
    /dev/mapper/vg-www (4295MB)
    /dev/mapper/vg-vmail (10,7GB)
    /dev/mapper/vg-ftp (16,1GB)
    /dev/mapper/vg-var (9999MB)
    /dev/mapper/vg-tmp (1996MB)
    /dev/mapper/vg-home (43,1GB)
    /dev/mapper/vg-root (25,0GB)
    /dev/mapper/vg-swap_1 (1023MB)
    (parted) print free
    Model: ATA ST2000VN000-1H31 (scsi)
    Disk /dev/sda: 2000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags:

    Number Start End Size Type File system Flags
    1024B 1049kB 1048kB Free Space
    1 1049kB 512MB 511MB primary ext2 boot
    512MB 513MB 1048kB Free Space
    2 513MB 2000GB 2000GB extended
    5 513MB 2000GB 2000GB logical lvm
    2000GB 2000GB 90,1kB Free Space


    I would disconnect the 2T drives, install a small, fast, security erased
    SSD, connect the SSD to the motherboard first HBA port, boot into Setup,
    do a "Factory Reset", configure settings as desired (e.g. UEFI mode),
    and do a fresh install of Debian onto the SSD with a 1G ext4 boot, 1G
    swap, and everything else on ext4 root (encrypt swap and/or root as
    desired). Once that is up and running, reconnect the 2T drives, disable
    the boot flag on sda1 and/or sdb1, install/configure LVM to access the
    contents of your 2T drives, and install/configure software.


    David

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tommy Berglund@21:1/5 to All on Tue May 27 17:10:01 2025
    lör 2025-05-24 klockan 17:59 +0000 skrev Andy Smith:
    Hi,

    On Sat, May 24, 2025 at 03:31:03PM +0200, Tommy Berglund wrote:
    Is it possible to add an EFI system partition to a server already
    running Debian 12?


    So, you're going to have to

    - Reboot and get into the BIOS/firmware of your machine to set it to
      UEFI boot mode

    I checked the BIOS on the server and found no support for UEFI boot
    mode.
    I'm not making any changes now, waiting until the new server is in
    place.
    Thanks for all the help!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joe@21:1/5 to Alexander V. Makartsev on Tue May 27 21:20:01 2025
    On Tue, 27 May 2025 22:14:03 +0500
    "Alexander V. Makartsev" <avbetev@gmail.com> wrote:

    On 24.05.2025 22:40, Joe wrote:
    Looks like you need to shrink lvm a bit. EFI needs a partition
    formatted to one of the FAT family filesystems, with no additional
    software needed to access it, so no encryption or LVM. The size recommendation for Linux is 1GB minimum. It's generally advised to
    keep it near the beginning of large discs.
    You have Boot partition and EFI partition mixed up. They are
    different things.

    No, I wasn't considering the /boot (minus /boot/EFI) partition at all.

    EFI partition have to be formatted to FAT32, but its safe and
    sufficient size could be even 100MB, because only UEFI executable
    binaries go there.

    Yes, that's what MS recommends, but MS notoriously under-specifies
    various minimum requirements and has done for decades.

    The Internet generally recommends 100-500MB. There are recommendations
    for 1GB.

    The points to consider are that nobody knows what /boot/efi might need
    to contain in the future, in addition to the current files, and given
    modern drive sizes, the odd GB here or there is a rounding error. If
    you reach the point where 900MB less spare space is really becoming an
    issue, it's time you moved to a bigger drive or added more LVM space.

    --
    Joe

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Felix Miata@21:1/5 to All on Tue May 27 21:40:02 2025
    Joe composed on 2025-05-27 20:11 (UTC+0100):

    The points to consider are that nobody knows what /boot/efi might need
    to contain in the future, in addition to the current files, and given
    modern drive sizes, the odd GB here or there is a rounding error. If
    you reach the point where 900MB less spare space is really becoming an
    issue, it's time you moved to a bigger drive or added more LVM space.

    The future is already here. Up until recently, more than 100M on disks with 512b
    sectors resulted in lots of wasted space even with several distros installed in addition to Windows. All my UEFI installations are multi-multiboot, with 12 to 25
    or more installations, yet with my 320M ESPs, not even close to 20% of space has
    been consumed. With 4k sectors, the minimum was 260M for disks of 16T or more.

    Now with alternatives to Grub such as systemd-boot, even 1G might be too conservative, as distros are putting there kernels and initrds there on systemd-boot installations. If sticking to Grub, 500M is nearly complete waste.

    As with UEFI it is of no consequence where on disk the ESP is located, should need
    for more ESP space arise, a new larger one should be able to be carved out anywhere to replace the original, and the original ignored or removed.

    I'm sticking with Grub, as I shudder to think of my kernels and initrds being hosted on a FAT filesystem.
    --
    Evolution as taught in public schools is, like religion,
    based on faith, not based on science.

    Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

    Felix Miata

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Paoli@21:1/5 to tommy@fam-berglund.eu on Sun Jun 8 10:20:01 2025
    Yes, very doable, though may be rather to quite non-trivial to do so.

    I not long ago basically did this on a pair of drives on my laptop (yes
    it supports up to at least 3 internal drives, and I nominally have 2) -
    I'd not long ago replaced my relatively ancient ~150G SSD that
    finally died (zero data loss, thank you md raid1 !). So, replace that with ~2TiB SSD (rather similar to my existing other drive). And, in doing so,
    I wanted to be more future-proof (or at least future resistant) in my setup
    for that drive, so I did it GPT rather than MBR, and likewise went back and similarly updated the other drive too (and thanks to mv and LVM, and
    having 2 drives, did most all of that live).

    I'd also strongly suggest, for backwards compatibility, also include a
    BIOS partition too (takes only very small bit of space).

    Anyway, this is what I've got (partitions quite matched on
    both drives):

    # sfdisk -uS -l /dev/sda | sed -ne '/^Diskl/p;/^Device /,/sda3/p'
    Disklabel type: gpt
    Device Start End Sectors Size Type
    /dev/sda1 2048 6143 4096 2M BIOS boot
    /dev/sda2 6144 2097151 2091008 1021M EFI System
    /dev/sda3 2097152 4194303 2097152 1G Linux RAID
    #
    That 3rd partition is md raid1 for /boot - though one could just do
    regular ext2/3/4 filesystem.
    One can then set that up and do either BIOS legacy boot or EFI boot,
    no further changes needed.
    Recommended/minimum for BIOS boot is 1 MiB, I gave it 2 MiB "just in
    case" and to play it
    safe (hey, storage is pretty cheap!).
    EFI I did ~1GiB - should be ample - and aligned it to end just short
    of the next partition at precisely 1GiB
    offset from start of drive (that and all subsequent partitions I have
    starting at exactly integral multiples of
    1GiB from start of drive). Such alignment is beneficial for solid
    state storage, and 4KiB alignment
    is crucial for performance for many modern drives (my newest is both
    logically and physically 4KiB,
    whereas my slightly older is physically 4KiB, but logically 512B, but
    doing misaligned is grossly inefficient
    for writes). And those ~1GiB sizes for EFI and boot should be ample,
    but one could always make
    that closer to 2GiB if one really needed/wanted - but I figure 1GiB on
    those will likely hold me
    for a decade or so (probably for longer than the life of those
    drives). And, that was also kind of
    the intent too - do partitioning once on the new drive, and hopefully
    never need to change it (at least
    partition boundaries/locations/sizes anyway, but might possibly want
    to change types on some at some point)
    again within the lifetime of the drive. And similar caught up the
    older drive (its layout was kind of an extension
    based upon much older drive that was about a decade old and finally
    died). And with LVM, md, ZFS, etc.
    I generally shouldn't have any need to be changing partition sizes or locations.

    And with my 2 drive setup, either drive dies, I can boot the other,
    and all the particularly critical/important
    data is RAID-1 protected (though for EFI, I have to manually replicate
    that between the two drives,
    but that's easy enough). And of course when (re)installing GRUB, I
    have to remember to do it for both
    drives ... but the more routine GRUB configuration updates are easier,
    as that's just within /boot, which
    I already have md raid1 on both drives - so those updates
    automatically are fully covered on both drives.

    On Sat, May 24, 2025 at 6:41 AM Tommy Berglund <tommy@fam-berglund.eu> wrote:

    Hi,
    Translated by Google from Swedish

    Is it possible to add an EFI system partition to a server already
    running Debian 12?
    How do I do it?

    (parted) print devices
    /dev/sda (2000GB)
    /dev/sdb (2000GB)
    /dev/mapper/vg-data (1888GB)
    /dev/mapper/vg-www (4295MB)
    /dev/mapper/vg-vmail (10,7GB)
    /dev/mapper/vg-ftp (16,1GB)
    /dev/mapper/vg-var (9999MB)
    /dev/mapper/vg-tmp (1996MB)
    /dev/mapper/vg-home (43,1GB)
    /dev/mapper/vg-root (25,0GB)
    /dev/mapper/vg-swap_1 (1023MB)
    (parted) print free
    Model: ATA ST2000VN000-1H31 (scsi)
    Disk /dev/sda: 2000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags:

    Number Start End Size Type File system Flags
    1024B 1049kB 1048kB Free Space
    1 1049kB 512MB 511MB primary ext2 boot
    512MB 513MB 1048kB Free Space
    2 513MB 2000GB 2000GB extended
    5 513MB 2000GB 2000GB logical lvm
    2000GB 2000GB 90,1kB Free Space


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)