Configure PMBR to Find Loader on GPT Disk

Jason C. Wells jcw at
Thu Jun 10 00:28:49 UTC 2010

Jason C. Wells wrote:
> After setting up a GPT disk and installing the boot blocks with:
>    # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ad4
> The system wants to boot:
>    0:ad(0p2)/boot/kernel/kernel
> I manually intervene to cause the system to boot:
>    1:ad(5p8)/boot/loader
> How do I configure the boot blocks to do this without human 
> intervention on a GPT system?  boot0cfg doesn't seem to be the correct 
> tool for this job.
The docs and various guides around the net could use a little help.  
Please correct me below.  My C and assembly is non-existent and I 
discovered the information below by trial and error and reading the source.

My subject header is wrong.  The pmbr is working just like it should.  
It is gptboot that is failing to find my boot loader.

I found a work around for the non-configurability of the pmbr/gptboot 
code.  gptboot searchs for the first UFS partition and tries to use that 
partition as root.  In my partition scheme, the first partition was for 
user data. The presence of boot.config in the first partition will cause 
gptboot to boot some other disk and partition of your choice.  In my 
case, I added 1:ad(5p8)/boot/loader to boot.config on 0:ad(4p2) to allow 
my system to boot automatically.

Also, some guides online magically select the size of 64k for the 
freebsd-boot partition.  This is not just magic. It's mandatory.  The 
pmbr boot code assume that the partition is not larger than 64k and 
complains if it is larger.  Ref my earlier message on that topic.

The bad part about all of this is that I intend to build a mirror from 
two disks. Will my boot process be brittle because the boot.config is 
not actually located in / where it truly belongs?  If I pull bios disk 
0, then when I boot, bios disk 1 will be renumbered to bios disk 0.  The 
boot.config file won't be there.  The system will fail to boot.

It sure would be nice if 'gpart bootcode' would accept 
'1:ad(5p8)/boot/loader' as an option so I don't have to be sticking 
boot.config files in weird locations.


A partition of type freebsd-boot is NOT where you mount /boot.

More information about the freebsd-questions mailing list