Thursday, October 21, 2004

Dual-boot FreeBSD 5.3 and Windows 2000

For my testing of FreeBSD 5.3 before it's available as a RELEASE, I decided to work on dual-booting it with Windows 2000. I did not want to use any third-party boot loaders unless absolutely necessary.

I preferred to use the FreeBSD boot loader as FreeBSD is the primary OS on my Thinkpad a20p. Unfortunately, I could not figure out a way to overcome the different ways Windows and FreeBSD see disk geometry while using the FreeBSD boot loader. The following describes how to dual-boot FreeBSD 5.3 and Windows 2000 with Windows in the Master Boot Record handling boot selection. I found these notes helpful although I did not following all of the author's recommendations.

First I installed Windows 2000 in a 7427 MB C: partition, formatted as NTFS. I also created a 30727 MB D: partition to hold FreeBSD, although I only let the Windows installation process create the partition and nothing more.

Next I began the FreeBSD installation process using a CD-ROM. When it came time to partition the drive I saw this message:

WARNING: A geometry of 77520/16/63 for ad0 is incorrect.
Using a more likely geometry. If this geometry is incorrect
or you are unsure as to whether or not it's correct, please
consult the Hardware Guide in the Documentation menu or use
the (G)eometry command to change it now.

Remember: you need to entry whatever your BIOS thinks the
geometry is! For IDE, it's what you were told in the BIOS
setup. For SCSI, it's the translation mode your controller
is using. Do NOT use a "physical geometry."

I hit 'ok' and continue to the partition menu. I deleted the partition identified by FreeBSD as ad0s2 "extended DOS, LBA" (the D: drive created while installing Windows) and created a FreeBSD partition. Crucially, I set the Bootable flag on ad0s1 which held the NTFS partition for Windows 2000.

When asked how to handle the MBR, I chose to Leave the Master Boot Record untouched. This preserved the Windows code in the MBR. Because Windows knew of another partition (originally D:) I believed the boot loader show know how to find the new FreeBSD partition in the same location.

After that I proceeded with the regular FreeBSD installation tasks of creating /, /usr, and so on. When done I rebooted and found myself again in Windows 2000. At this point Windows is not aware of FreeBSD and one cannot access the FreeBSD installation without a boot disk.

I inserted the FreeBSD installation CD-ROM and copied the boot/boot1 file to a new file called c:\freebsd. I then modified the c:\boot.ini file by running 'notepad c:\boot.ini'. You cannot find this file with 'Search' or via Explorer as it is hidden from normal view.

I added the following at the very end of the boot.ini file:

c:\freebsd="FreeBSD 5.3 REL"

After saving changes I rebooted Windows. The next time Windows appeared I had the choice of booting Windows 2000 or FreeBSD 5.3-REL. Either OS can now be started from this menu.

5 comments:

Anonymous said...

re: Dual Booting FreeBSD with Windows 2000
Hi Richard
thank you so much for the article you wrote. I tried it and it worked. I did it a little different to what you said.
1) I installed FreeBSD first, no W2K at all on the disk. I used the option to use the FreeBSD MBR.
2) I installed W2K. It told me it had to have the active boot record (or whatever it's called). So I let it and I happily installed W2K.
3) I rebooted and there is no sign of FreeBSD.
4) I followed your instructions and copied the boot/boot1 file from the install disc to a new file called c:\freebsd. The version of FreeBSD I'm using is 5.4 REL.
5) Made the change to the boot.ini file.
6) Bingo, it worked first pop.
Thanks a million
Mark

Serg said...

I can also advise useful soft for such purposes:
emboot MBA on Disk for VM; zBoot Manager by ZBM soft; Acronis Disk Director Suite

Mark said...

For five hours I have been searching for this exact information and have been tearing my hair out on how to boot into FreeBSD if its MBR is no longer present! Life saver!

Anonymous said...

hi, how do you copy the boot0? do you use dd like in Linux?

Anonymous said...

This is a FAQ:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NT-BOOTLOADER