# Yet another Windows/FreeBSD dual boot trouble



## freethread (Aug 8, 2012)

I'm on a brand new Intel Atom D525 motherboard with one SATA 320GB HDD, it has 4 primary partitions (MBR): 1st and 2nd partitions with Windows 7 64bit (NTFS), 3rd partition is not used (NTFS), 4th partition with FreeBSD 9-RELEASE amd64 (BSD).

I first installed Windows and played with it for a couple of days, then installed FreeBSD from USB stick on 4th partition and palyed with it for a couple of day. The problem is that now the system start in FreeBSD, no way to start in Windows again.

I did try to restore Windows boot sector, I ran the console from Windows installation CD with bcdboot and bootsect (with all the options available) but it seems there's no way to restore boot sector. If I delete the 4th partition (with FreeBSD) the system boot with Windows with no need to restore boot sector.

the command bootsect
[CMD="X:>"]bootsect /nt60 d: /mbr[/CMD]
give me an error, it say it cannot write boot info to that location (or sort of)
the command
[CMD="X:>"]bootsect /nt60 d: /force /mbr[/CMD]
give no errors but does nothing.

Any suggestion or solution is welcome. Since the system is new (1 week old) I can try any solution.
Thanks for your help


----------



## windscape (Aug 8, 2012)

Hi,

It sounds like you need a boot manager and don't have one currently installed. The boot manager section of the Handbook at http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-blocks.html explains how to use FreeBSD's boot manager. You'd either need to install that one or another one. When I had Windows 7 and FreeBSD installed, FreeBSD's boot manager worked fine. I think the SSD was partitioned using an MBR scheme. Now I have Linux and FreeBSD installed and use SYSLINUX as my boot manager using a GPT partition scheme. This is on a motherboard with a BIOS, not UEFI.


----------



## freethread (Aug 8, 2012)

There are things I will never undertand. I thought to delete FreeBSD partition, fortunately I gave a chance to boot0cfg found while reading disk management related manual pages. I executed
`# boot0cfg -B ada0`
then
`# boot0cfg -s 1 ada0`
the system starts with FreeBSD boot loader showing

```
F1 Win
F2 Win
F3 Win
F4 FreeBSD
```
and all works (F1 for Windowss 7, F4 for FreeBSD), that's all I need.

The ada0 geometry is


```
=>       63  625142385  ada0  MBR  (298G)
         63       1985        - free -  (992k)
       2048     204800     1  ntfs  (100M)
     206848  289392640     2  ntfs  (138G)
  289599488  167772160     3  ntfs  (80G)
  457371648         36        - free -  (18k)
  457371684  167770701     4  freebsd  [active]  (80G)
  625142385         63        - free -  (31k)

=>        0  167770701  ada0s4  BSD  (80G)
          0  159383552       1  freebsd-ufs  (76G)
  159383552    8387148       2  freebsd-swap  (4G)
  167770700          1          - free -  (512B)
```

Before to install FreeBSD I installed EasyBCD and not created a deploy USB stick. In Windows XP the EasyBCD deploy disk (USB stick) cannot be created.

Now I will try to install the FreeBSD installation in a VirtualBox VM using

```
VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk
           -rawdisk \.\PhysicalDrive0 -partitions 4
```
to access the same FreeBSD installation both in VistualBox under Windows and directly booting into it at startup. Anyone already has experience about that kind of VirtualBox disks?


----------



## kpa (Aug 8, 2012)

I would guess the real problem is the active partition, if you want windows to boot first the active partition has to be changed to partition 1.

`# gpart set -a active -i 1 ada0`

Keep the boot0cfg(8) loader though, it will be the only way to get back to FreeBSD if you do the above change.


----------



## freethread (Aug 8, 2012)

kpa said:
			
		

> I would guess the real problem is the active partition, if you want windows to boot first the active partition has to be changed to partition 1.
> 
> `# gpart set -a active -i 1 ada0`
> 
> Keep the boot0cfg(8) loader though, it will be the only way to get back to FreeBSD if you do the above change.



Thanks for your advice. I will keep FreeBSD boot loader, it works very well. Also, FreeBSD run at speed of light on this machine, I'm thinking to get onother one and replace my XVI century server (PII 466MHz).

This is my second attempt to a multi boot machine after an unsuccesful attempt two or three years ago on a PIV 2.5GHz.


----------



## phobis (Aug 14, 2012)

unsure but NT denies changes to any boot sector different than C:/
installing a bootblock should work fine.


----------



## freethread (Aug 14, 2012)

For what I'd understood, Windows install the boot loader only in the case of installation of a secondary Windows OS, if you have only one Windows OS there's no way to install Windows boot loader using Microsoft tools.


> unsure but NT denies changes to any boot sector different than C:/


probably you are right, I don't want to know the why and the how, anyways there's no Microsoft tools that works like FreeBSD boot0cfg, a 'two seconds' boot loader installer and configurator tool, I spent over 6 hours to try to do same thing with bsdboot, bootsect and bootmgr, well, I installed xorg, mc, xfce and firefox in the while, looking for info about how the hell to boot back in Windows.


----------

