Loose EFI partition

Last time I had to reboot my laptop, it wouldn’t… Annoying isn’t it?

Whats wrong? I checked to boot device in the UEFI, it was correct. Hum… it does not smell good. I had no fear for the data, I have more than 3 different backups of my home, and the configuration files (/usr/local/etc/*) but reinstallation and restoring take a loooong time. I need a better and faster solution.

So I checked on my usb key a FreeBSD one. And… I found it. Hurray \o/

Booting on the USB key

Not a big deal, just plug the USB key on the laptop and boot. When the install process start, I choose to have a shell.

Read the gpart of the internal disk

In fact it’s not a disk but a ssd. The process remain the same.

gpart show nvd0
=>        40  1953525088  nvd0  GPT  (932G)
          40      409600     1  efi  (200M)
      409640        1024     2  freebsd-boot  (512K)
      410664         984        - free -  (492K)
      411648    16777216     3  freebsd-swap  (8.0G)
    17188864  1936334848     4  freebsd-zfs  (923G)
  1953523712        1416        - free -  (708K)

Ok the EFI partition is the number 1 (nvd0p1).

Mounting the EFI partition

On the Internet I found many tutorial that want me to mount nvd0p1 on /mnt.1

First, UBS Key filesystem is read-only. I cannot mount anything on /mnt.

Well, the only writable filesystem was… /tmp. So I made a folder in /tmp:

 mkdir /tmp/efi

and try again to mount the nvd0p1 partition… Once again without success :-(

fdisk told me that it’s a fat partition… But it seems it was to damaged to be mounted.

A risk solution

SO, what to do? The consulted website gave me a way, with the links referenced on the bottom.2

The small exercice on this page will help me.

Make a new filesystem

What’s on the EFI partition? I don’t know and I don’t have a way to know it. What’s the risk to loose this partition? Nothing I can’t even boot the laptop. The worst situation could be to reinstall the system.

After those thinking I decided to put a correct filesystem on the EFI partition:

 newfs_msdos -F 32 -c 1 /dev/nvd0p1

Then I can mount it on /tmp/efi and copy the boot kernel from the USB-key to this partition:

 mount -t msdosfs /dev/nvd0p1 /tmp/efi
 mkdir -p /tmp/efi/EFI/BOOT
 cp /boot/loader.efi /mnt/efi/EFI/BOOT/BOOTX64.efi
 umount /tmp/efi

It’s time

Time to reboot and see if it’s ok.



Just after the UEFI laptop part (Lenovo logo), geli ask me for the crypt passphrase… And the OS boot.

To conclude

With the help of those two websites and a little part of my brain, I surely gain a lot of restoration time. To have more inforations about the boot process of FreeBSD, look at the handbook, chapter 13

powered by FreeBSD