md   :multiboot  services   résumé   portfolio   pursuits   contact 

Installing FreeBSD 4.x / 5.x and Windows XP Together

Here are some notes I decided to jot down after one-too-many blown installations of Windows XP Pro and FreeBSD on the same physical drive. Unless you get the sequence just right, you can be left with an invalid partition map (an unbootable drive with no access to either operating system), lost time and data.

(I also figured out how to do this with Linux.)

I wanted both operating systems on the drive, selectable via the standard Windows XP boot menu. I scanned the web and found a lot of stuff for various permutations of FreeBSD, Linux, and Windows, third party boot loaders, etc. But no clear step-by-step guide for just plain old XP and FreeBSD. Further, what hints there were had you using dd to extract FreeBSD boot record files, using attrib to modify flags on the Windows boot.ini, etc. It was all quite unnecessary.

After my exploration, I came up with the following simplified recipe. It works for FreeBSD 4.x and FreeBSD 5.x. No special software is needed other than the setup CDs for the operating systems. Follow this order, as enumerated below. I hope it saves you some grief.



   Partition the drive and install Windows

* Note: These steps are needed only for preparing a new drive for both operating systems. If you already have Windows XP installed, you can skip this, but be sure you have an unused extended partition ready for FreeBSD. I found that I had to create and delete one within Windows (steps 6, 7, and 8 below) for the partition map to be prepared correctly.

  1. Boot the Windows XP Pro installation CD
  2. Create a primary partition for Windows (C:)
  3. Create a second partition for FreeBSD (D:)
  4. Format and install XP on the primary partition (C:)
  5. Boot into Windows XP
  6. Open the Computer Management administrative tool
  7. Click Disk Management
  8. Delete the secondary partition (D:)
   Install FreeBSD
  1. Boot the FreeBSD installation CD
  2. Do a Custom install and set the Options as appropriate
  3. Choose the FDISK option
  4. Select the first partition (aka C:)
  5. S)et bootable (which causes the Windows boot selector to work)
  6. Select the second, unused partition (aka D:) on which FreeBSD will go
  7. Set the T)ype to 165 (FreeBSD)
  8. Q)uit and choose N)one to leave the Windows boot record intact
  9. Finish the disk labeling, distributions, and other installation steps
   Set up the Windows boot menu
  1. Boot into Windows XP if you're not already there
  2. Locate the /boot/boot1 FreeBSD master boot record file
    Note: The standard 512-byte FreeBSD MBR file is /boot/boot1 on every installation, including the FreeBSD CD which is readable from Windows.
  3. Place the MBR file in C:\ and name it boot1.bsd
  4. Open the System Properties window
  5. Click the Advanced tab
  6. Under Startup and Recovery, click Settings
  7. Click Edit to open the boot.ini file in Notepad
  8. Add this line to the end of the file and save:

    C:\BOOT1.BSD="FreeBSD"

  9. Close the Startup and Recovery settings, open it again, and FreeBSD should now appear in the Default operating system drop-down menu.
  10. If your FreeBSD boot device is not on the first IDE controller (e.g., it's on ad4s2 instead of ad0s2, typical with PCI IDE, RAID, or onboard SATA interfaces), create a C:\loader.conf file and enter these lines, adjusted for your drive's location:

    boot_disk_unit="4"
    currdev="disk4s2a"
    rootdev="disk4s2a"

    (Thanks to Gary Cuppett for this hint.)
  11. Reboot and test it out
After rebooting, it should bring up the Windows XP boot menu with your new operating system options.


  COPYRIGHT © MORGAN DAVIS