# Question about MBR



## TheNewUser (Jun 3, 2014)

I have installed FreeBSD on my HDD slice 4, Windows is on slice 2. After I installed it, my computer could only boot FreeBSD, I had no other options. I used gpart to set the the Windows partition active again, meaning I could now only boot Windows. I then used Windows' BCDEDIT to set the Windows boot loader to load FreeBSD as default after a few seconds of waiting.
Everything now seems OK. However, is the MBR still FreeBSD's? Did I just set FreeBSD's bootloader to boot the active partition with Windows, only to boot FreeBSD again? If so, I should probably restore the Windows MBR I have backed up?

In my opinion, the FreeBSD installer should ask clearly before making any changes to MBR/active partitions. I used manual install, but it never said anything.

Also, I had a huge bug while doing all this, my BIOS setings were back to default, even the date/clock and password.  I dont know if it is FreeBSD's or BCDEDIT's fault.


----------



## kpa (Jun 3, 2014)

MBR and active partition are two different things allthough they are both stored in the same first 512 byte sector of the disk. MBR is the boot code to enable booting and active partition is the entry in the partition table that has the active flag on. Note that there can be only one partition that is marked as active. You need some kind of boot manager to enable multibooting and selection of boot partition. FreeBSD has the boot0 boot manager that can be installed on the MBR with boot0cfg(8). The other option that allows you to keep the Windows partition as the active partition is to use EasyBSD.


----------



## TheNewUser (Jun 3, 2014)

OK, thank you. I didn't run boot0cfg, so the installation didn't write a new MBR, it only changed the active partition?


----------



## kpa (Jun 3, 2014)

The installation could have overwritten the MBR but it is very possible that the same MBR code that boots FreeBSD also boots Windows just fine. There is very little variation in what the MBR can do to enable booting on MBR partitioned disk that it's very likely that you'll never notice the difference between the real Windows MBR or the one installed by FreeBSD. I do know that the boot0 bootloader (that is installed on the same MBR) boots Windows 7 just fine from my own experience.

So yes, the net effect in your case was that only the active partition got changed. Whatever changes were done to the MBR boot code didn't have any effect.


----------

