Re: changing ext. USB disk to UEFI boot

From: Paul Mather <paul_at_gromit.dlib.vt.edu>
Date: Wed, 03 Apr 2024 13:28:53 UTC
On Apr 3, 2024, at 4:29 AM, Matthias Apitz <guru@unixarea.de> wrote:

> El día miércoles, abril 03, 2024 a las 12:23:57 -0700, Edward Sanford Sutton, III escribió:
> 
>>> How can I modify the partition da0p1 to UEFI without touching the already
>>> installed da0p2? Is it enough to carry out the creation of the MS-DOS
>>> file system in da0p1 and copy the boot loader /boot/loader.efi to it?
>> 
>> If it was bigger it would have worked. With such a small da0s1, consider
>> deleting the swap partition, make a UEFI partition from part of its space,
>> then make a swap partition from what remains. You would then have both UEFI
>> and legacy booting available while avoiding a reformat. Manpages for
>> loader.efi(8) and uefi(8) explain where it can go and what to name it.
> 
> Thanks, this is a nice idea. I never used this swap partition on this
> external disk. As I said, it is only for testing a new FreeBSD or
> compiled ports tree (with poudriere) before installing it.
> 
> So, I will delete the da0p3 and recreate it as -t efi, perhaps in
> smaller size of 40M. The da0p4 is used for backup purpose.
> Is it a problem that the efi partition is not the first one, or does
> this no matter?


FWIW, here is the partition table that got created via a default ZFS-on-root install of a FreeBSD 13 system I use:

# gpart show ada0
=>        40  1953525088  ada0  GPT  (932G)
          40      532480     1  efi  (260M)
      532520        1024     2  freebsd-boot  (512K)
      533544         984        - free -  (492K)
      534528     4194304     3  freebsd-swap  (2.0G)
     4728832  1948794880     4  freebsd-zfs  (929G)
  1953523712        1416        - free -  (708K)


Note the default size of 260 MB for the EFI partition.

Cheers,

Paul.