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

Re: EFI system partition



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
>


Reply to: