Re: Corrupted/broken EFI boot partition

From: Juan Manuel Palacios <jmpalacios_at_gmail.com>
Date: Fri, 13 Dec 2024 19:59:21 UTC
Hi Julf,

Thank you for posting this resolution! Just the one question: when you say

gpart add -i 1 -a 4k -2 260M -t efi da0

did you mean -s for the 260M partition size? I’m reading a dash-two there, which seems odd.

Thank you,

> On Dec 13, 2024, at 10:31 AM, Johan Helsingius <julf@julf.com> wrote:
> 
> Replying to myself in case anyone else is in the same situation.
> 
> Managed to repair the EFI partition by booting into the live
> environment of the installer image, deleting the corrupted
> EFI partition with
> 
> 	gpart delete -i 1 da0
> 
> and then recreating it with
> 
> 	gpart add -i 1 -a 4k -2 260M -t efi da0
> 	newfs_msdos -F 32 -c 1 /dev/da0p1
> 	mount -t msdosfs -o longnames /dev/da0p1 /mnt
> 	mkdir -p /mnt/efi/freebsd
> 	cp /boot/loader.efi /mnt/efi/freebsd/loader.efi
> 	efibootmgr --create --activate --label "FreeBSD" --loader \
>             "/mnt/efi/freebsd/loader.efi"
> 	umount /mnt
> 	
> (I then did the same for the other disks in the array just for
> redundancy)
> 
> 	Julf
> 
> On 12/12/2024 15:13, Johan Helsingius wrote:
>> Hi,
>> I have a server with 4 disks with most of the disk as a 4-way ZFS
>> root partition, and small EFI, freebsd-boot (as an emergency
>> backup) and swap partition. For some reason the EFI partitions
>> seem to have gotten corrupted in one of the updates, so the server
>> simply refuses to boot using UEFI, and when trying to boot using
>> BIOS booting, it complains about the efi partition being corrupted
>> (and trying to mount it as a msdos partition results in failure
>> as the partition is not valid.
>> What would be the easiest way to recreate the boot partitions
>> without affecting the ZFS partitions)?
>> 	Julf
> 
>