Copy bootcode to mirror disk?

Warren Block wblock at
Mon Jun 27 14:29:07 UTC 2016

On Sun, 26 Jun 2016, perikillo wrote:

> On Fri, Jun 24, 2016 at 7:06 PM, Warren Block <wblock at> wrote:
>> On Fri, 24 Jun 2016, Vladislav Prodan wrote:
>>> Make the mirror bootable by installing bootcode in the MBR and bsdlabel
>>> and setting the active slice:
>>> # gpart bootcode -b /boot/mbr mirror/gm0
>>> # gpart set -a active -i 1 mirror/gm0
>>> # gpart bootcode -b /boot/boot mirror/gm0s1
>> That is only valid for a GPT disk.  The problem is that the boot partition
>> is mirrored.  The bootcode can probably be written to mirror/boot.
>> However, as I said on the forums to this very same thread, the real error
>> here is having mirrored GPT partitions.

> One issue here is that right I cannot sit and change this, will be good to
> do that but my time is on other projects now.
> Them in my case there is no way to fix this?

(Please don't top-post, it makes replying more difficult.)

First, make a full backup.  Seriously.

The temporary way to fix it is to write the bootcode to the boot 
partition mirror.  gpart might refuse to do that.  If it refuses, the 
boot partition mirror can be destroyed.  The only purpose to have it is 
to make sure that bootcode is mirrored, and if it is preventing that, it 
is not useful.

After destroying that boot partition mirror, write the bootcode 
individually to both drives.  Since bootcode rarely changes, this should 
be adequate.  Of course, the computer must still be able to boot from 
either drive, or having bootcode on both does not help much.

More information about the freebsd-questions mailing list