In the event that the boot loader were wiped out, how would one restore it?
Thanks.
Thanks.
% gpart show ada0
=> 40 937703008 ada0 GPT (447G)
40 409600 1 efi (200M)
409640 928628736 2 freebsd-ufs (443G)
929038376 8388608 3 freebsd-swap (4.0G)
937426984 276064 - free - (135M)
gpart bootcode -p /boot/boot1.efi -i1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptboot-i1 ada0
It's important to know if your bootcode is UEFI or BIOS.
Code:% gpart show ada0 => 40 937703008 ada0 GPT (447G) 40 409600 1 efi (200M) 409640 928628736 2 freebsd-ufs (443G) 929038376 8388608 3 freebsd-swap (4.0G) 937426984 276064 - free - (135M)
If the first partition is 'efi', like above, you have UEFI bootcode in first partition and MBR is clear/not used.
If it were 'freebsd-boot', than it is BIOS bootcode inside that partition and an entry inside the Master Boot Record/sector 0 as well.
Size of first partition doesn't really matter.
Examples assume you use GPT partitioning.
Create UEFI bootcode:
gpart bootcode -p /boot/boot1.efi -i1 ada0
Create BIOS bootcode:
gpart bootcode -b /boot/pmbr -p /boot/gptboot-i1 ada0
gpart bootcode -p /boot/boot1.efi -i1 ada0
gpart bootcode -b pmbr -p /boot/gptzfsboot -i1 ada0
Remember it is allways a good idea to install bootcode on every disk in a pool.
It's important to know if your bootcode is UEFI or BIOS.
Code:% gpart show ada0 => 40 937703008 ada0 GPT (447G) 40 409600 1 efi (200M) 409640 928628736 2 freebsd-ufs (443G) 929038376 8388608 3 freebsd-swap (4.0G) 937426984 276064 - free - (135M)
If the first partition is 'efi', like above, you have UEFI bootcode in first partition and MBR is clear/not used.
If it were 'freebsd-boot', than it is BIOS bootcode inside that partition and an entry inside the Master Boot Record/sector 0 as well.
Size of first partition doesn't really matter.
Examples assume you use GPT partitioning.
Create UEFI bootcode:
gpart bootcode -p /boot/boot1.efi -i1 ada0
Create BIOS bootcode:
gpart bootcode -b /boot/pmbr -p /boot/gptboot-i1 ada0
Do I have to use a rescue / install disk ? I'm still getting Operation not permitted. I read somewhere (above) that it wasn't required to boot up the install medium.Out of date. See here: https://forums.freebsd.org/threads/update-of-the-bootcodes-for-a-gpt-scheme.80163/
And please, read well.
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 nvd0
You tried to put a BIOS bootcode in a EFI partition. This last is probabled mounted on /boot/efi, hence the operation not permitted.
As I said, read well the howto. I can't explain better.
Important note: if you started with a 13.0-RELEASE installation, the partition where the efi loader resides is mounted on /boot/efi. In this case, you cannot mount the partition on /mnt. mount will answer "Device is busy".
So, the procedure becomes:
cp /boot/loader.efi /boot/efi/efi/boot/bootx64.efi
Boot to FW : false
BootCurrent: 0019
Timeout : 0 seconds
BootOrder : 0000, 0001, 0019, 0010, 0011, 0012, 0013, 001B, 0017, 0018, 001A, 001C, 001D, 001E, 0005
Boot0000* Windows Boot Manager
Boot0001* ubuntu
+Boot0019* NVMe0
Boot0010 Setup
Boot0011 Boot Menu
Boot0012 Diagnostic Splash Screen
Boot0013 Lenovo Diagnostics
Boot001B* USB HDD
Boot0017* USB CD
Boot0018* USB FDD
Boot001A* ATA HDD0
Boot001C* PCI LAN
Boot001D Other CD
Boot001E Other HDD
Boot0005* Linux-Firmware-Updater
BTW, here is my efibootmgr output. "FreeBSD" is still gone,
The efibootmgr program can be used to create new EFI boot variables. The
following command may be used to create a new boot method, using the EFI
partition mounted under /boot/efi, mark the method active, using the
given loader and label the method "FreeBSD-11":
efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-11