How to add legacy boot support for UEFI hard drive in GhostBSD

At first need to make legacy boot partition. In this hard drive ada0, has been a bios grub partition which has deleted and the created freebsd-boot partition.

For example, I do the required commands again.

gpart show command shows hard drives and partitions

At first I delete partition 1 from ada0

gpart delete -i 1 ada0

Then I create a new freebsd-boot partition

gpart add -t freebsd-boot -l LEGACYBOOT -a 4K -s 512K ada0

Then I add bootcodes to ada0

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0

gpart bootcode -b /boot/pmbr ada0

That is enough if you want zfs UEFI hard drive to be bootable from legacy bios computer.

In UEFI boot computer you need to disable UEFI boot and use legacy boot if you want to multiboot with some other har drive which has msdos partition table.

Change boot order for getting linux´s grub to control boot process.

For getting zfs pool GhostBSD to boot via linux´s grub, add the next line to the linux´s /etc/grub.d/40_custom file

menuentry "Boot GhostBSD from second disk and see it as first disk" {
set root=(hd1)
drivemap -s hd0 hd1
chainloader +1
}

When grub menu has edited and updated, then we can see how it works

Chainloader set GhostBSD drive as the first disk, and then GhostBSD boots fine

zfs filesystem is not good for dualboot or multiboot systems, but in GhosBSD ufs filesystem is not available, which a restriction many people whose uses many different operating systems.