Install UEFI FreeBSD on gmirror

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,588

I wanted to post instruction for installing FreeBSD on a GEOM_MIRROR -aka- gmirror(8).
This is an advanced topic so I assume you are capable of determining that your two chosen disks are empty.
UFS RAID1 on FreeBSD is enabled with the geom_mirror module.
I am using ada0 and ada1 as examples here.
Please make sure you know what your disks contain before using this. They will be wiped.

UEFI is needed to use this method. Run the following command from the shell to check first if unsure..
sysctl machdep.bootmethod
IT MUST EQUAL {machdep.bootmethod: UEFI}

This sequence of commands must be ran from the FreeBSD memstick installer 'Disk Partiton' phase.
In this phase you will see the below screen. Please pick shell. You will be shelling out of the installer to make disk modifications.

part.png

From the shell type these commands:
Code:
kldload geom_mirror
dd if=/dev/zero of=/dev/ada0 bs=1M  <<< I wipe my disks before use as RAID <<<
dd if=/dev/zero of=/dev/ada1 bs=1M  <<< You better know what your doing here <<<
gmirror label -v gm0 /dev/ada0 /dev/ada1
gpart create -s gpt /dev/mirror/gm0
gpart add -t efi -a4k -s 200M /dev/mirror/gm0
gpart add -t freebsd-ufs /dev/mirror/gm0
newfs_msdos -F 32 -c 1 /dev/mirror/gm0p1
mount -t msdosfs /dev/mirror/gm0p1 /mnt
mkdir -p /mnt/EFI/BOOT
cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi
umount /mnt
newfs -U /dev/mirror/gm0p2
mount /dev/mirror/gm0p2 /mnt
echo "/dev/mirror/gm0p2 / ufs rw 1 1" >> /tmp/bsdinstall_etc/fstab
echo 'geom_mirror_load="YES"' >> /tmp/bsdinstall_boot/loader.conf
exit

On exit the installer will continue with your installation. When done reboot and enjoy your FreeBSD RAID1 experience.
 
Last edited:
OP
Phishfry

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,588

Many UEFI BIOS have boot device settings for 'UEFI OS'
You should set your BIOS boot order to this and do not set it to a particular UEFI disk drive.
This way if you have to pull a drive or a reboot with dead drive it will be seemless to BIOS.
UEFI looks only for /EFI/BOOT/ directory not a particular drive.
 
Last edited:
Top