I want to dual-boot Microsoft Windows 7 and FreeBSD. Since the FreeBSD boot manager will be overwritten when installing Windows (I wonder if this will ever change. Probably not. OS evangelism aside, this is one of the things that truly sucks about a Windows installation), I decided to use the Microsoft Windows 7 boot manager to boot FreeBSD. This HOWTO outlines the necessary steps.

The procedure should work for the Windows Vista boot manager, too.

Setup

I am assuming a normal setup here, i.e.:

  • You have a working computer.
  • You want to install Windows 7 and FreeBSD on the same hard disk.
  • This hard disk is the primary disk.

FreeBSD installation

Perform a regular installation of FreeBSD. Create a partition, label the slices, choose the packages you want to install etc.

After the installation has finished, boot into your new system and copy /boot/boot1 to a safe location such as an USB stick.

Reboot and insert your Windows 7 DVD.

Windows 7 installation

Install Windows 7. You pretty much don't have any choices during the installation process except for selecting the correct partition. Double-check that you are not overwriting the FreeBSD partition.

After the installation has finished, boot into your new Windows system.

Configuring the Windows boot manager

Copy /boot/boot1 to C:\FreeBSD.mbr. We will now use some arcane magic that I have taken from OpenBSD's tome of answers and adapted for FreeBSD.

Open cmd.exe and create a new entry for the boot manager:

C:\Windows\system32> bcdedit /create /d "FreeBSD 7.2" /application bootsector
The entry {01234567-ABCD-ABCD-ABCD-0123456789AB} was successfully created.

C:\Windows\system32>

Substitute the GUID (i.e. {01234567-ABCD-ABCD-ABCD-0123456789AB}) that you received when executing the command from above for the next commands:

C:\Windows\system32> bcdedit /set {01234567-ABCD-ABCD-ABCD-0123456789AB} device boot
The operation completed successfully.

C:\Windows\system32> bcdedit /set {01234567-ABCD-ABCD-ABCD-0123456789AB} path \FreeBSD.mbr
The operation completed successfully.

C:\Windows\system32> bcdedit /set {01234567-ABCD-ABCD-ABCD-0123456789AB} device partition=c:
The operation completed successfully.

C:\Windows\system32> bcdedit /displayorder {01234567-ABCD-ABCD-ABCD-0123456789AB} /addlast
The operation completed successfully.

Further help is available if you call bcdedit /?. The documentation is also helpful if you want to fine-tune any settings.

Conclusion

This guide works perfectly for my system (FreeBSD 7.2 and Windows 7). There was not data loss or any other problem. However, I did a fresh install and restored from a backup. Your mileage may vary when you try to add Windows 7 to an existing installation of FreeBSD or vice versa.

In short: Be a man—take backups.