# problems with gpt partitioned drives



## wonslung (Jul 16, 2010)

I've run into a strange issue.


I have some servers which i use FreeBSD on that i must install remotely.  The method i've been using which seems to work well has been:

create a mfsbsd image, scp it to the server (which normally comes with linux installed on it via the hosting company, who doesn't install FreeBSD ) then dd it to the drive/drives


then i normally destroy the partition table and recreate it as gpt, i then create 7 partitions on each disk normally:

partition 1 for the bootblocks
partition 2 for root
partition 3 for swap
partition 4 for tmp
partition 5 for var
partition 6 for usr
partition 7 for home


I then load the kernel module for geom_mirror and create mirrors for partitions 2 4 5 and 6 
(i normally use raid0 for home, but i always do that later after the install works)

After i have my mirrors, i mount the one for root on /mnt then create 2 dirs, one for var and one for usr (i don't worry about tmp or home at this point) then mount those mirrors as well

i then use sysinstall to install a minimal freebsd

I then chroot into my install and create /etc/fstab, /etc/resolv.conf, /etc/rc.conf and /boot/loader.conf


i set the root password, and i edit the ssh config to allow logging in as root 

This normally works fine....I've installed several machines this way but i'm having trouble with one server in particular....no matter what i do it won't boot.  I've tried finding the error and i'm now convinced there is nothing wrong with my install (i  originally thought i may have made a mistake somewhere but i've double, tripple, quadruple checked everything.,....reinstalled several times..)  What is strange is when i use a vKVM it boots up (this hosting company's vKVM isn't a TRUE kvm, it's more like a virtualized kvm so it uses the data on the drives but virtualizes the hardware)

anyways, i asked the hosting company what they are seeing on the screen and they are seeing 


```
no bootable device insert boot disk and press any key
```


I'm 100% sure i've installed the bootloader correctly and on both drives....so i'm totally at a loss....



```
mfsbsd# gpart bootcode -b /boot/pmbr -p /boot/gptboot
 -i 1 ad2
 ad2 has bootcode
 mfsbsd# gpart bootcode -b /boot/pmbr -p /boot/gptboot
 -i 1 ad0
 ad0 has bootcode
 mfsbsd#
```


does anyone have any ideas of what might be happening or how i can fix this?


----------



## jem (Jul 22, 2010)

Some BIOS's stick their nose in where it's not required and actually check that there is an MBR partition flagged as active on the disk, otherwise they tell you the disk isn't bootable.  This is a problem when you use GPT, because you have no real MBR partitions.

The protective MBR installed on a GPT disk does create a fake MBR partition entry spanning the whole disk, but you still have to flag it as active to satisfy such BIOS's.  You can do this with 'fdisk -a _device_'.  fdisk may spit out some errors, but it gets the job done.

I don't know why such BIOS's do this - they should only concern themselves with loading and executing the code in the first sector of the disk and then mind their own business and let the MBR code do the rest.  I imagine it's some legacy thing from the early PC days.


----------



## wonslung (Jul 24, 2010)

I'll try that next time i have this error, i just made the hosting company swap the motherboard


----------

