VirtualBox

Using same installation for DualBoot and VirtualBoot

How to boot Windows from its partition with VirtualBox.

Summary

Install Windows

We will assume it is installed on partition 1.

Create disk

  • Create the MBR. Two ways, from your disk, but the second one seems better:
    dd if=/dev/sda of=disk.mbr bs=512 count=1

    or from scratch with install-mbr:

    install-mbr -e1 --force ./disk.mbr
  • Create the virtual disk:
    VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk /dev/sda -partitions 1 -relative -mbr disk.mbr # if single partition for windows
    VBoxManage internalcommands createrawvmdk -filename disk.vmdk -rawdisk /dev/sda -partitions 1,2 -relative -mbr disk.mbr # if boot + system partition for windows

Create machine

  • Create the virtual machine in VirtualBox the usual way, with the following settings:
    • check “Enable IO APIC” in System/Motherboard tab and “Enable PAE/NX” in System/Processor tab
    • set your real mac address for the Network adapter
  • Set the DMI BIOS information to avoid activation problems. Execute:
    sudo dmidecode -t0 # provides DmiBIOS* variables
    sudo dmidecode -t1 # provides DmiSystem* variables

    And update the values of the following script that you will then execute (if a value is listed as “Not specified”, set it to ”<EMPTY>”):

    #! /bin/sh
    VM_NAME="Win7" # Name of your Virtual Machine
    VSETED="VBoxManage setextradata $VM_NAME"
    CFG_PATH="VBoxInternal/Devices/pcbios/0/Config"
    # update the following values:
    $VSETED $CFG_PATH/DmiBIOSVendor       "Dell Inc."
    $VSETED $CFG_PATH/DmiBIOSVersion      "A08"
    $VSETED $CFG_PATH/DmiBIOSReleaseDate  "10/18/2011"
    $VSETED $CFG_PATH/DmiBIOSReleaseMajor  4
    $VSETED $CFG_PATH/DmiBIOSReleaseMinor  6
    $VSETED $CFG_PATH/DmiBIOSFirmwareMajor 2
    $VSETED $CFG_PATH/DmiBIOSFirmwareMinor 6
    $VSETED $CFG_PATH/DmiSystemVendor     "Dell Inc."
    $VSETED $CFG_PATH/DmiSystemProduct    "Precision M4600"
    $VSETED $CFG_PATH/DmiSystemVersion    "string:01"
    $VSETED $CFG_PATH/DmiSystemSerial     "9ZZ99Z9"
    $VSETED $CFG_PATH/DmiSystemUuid       "9Z9Z9999-9999-9999-9999-Z9Z99Z999999"
    $VSETED $CFG_PATH/DmiSystemFamily     "<EMPTY>"

Fix Windows

When you will boot your new virtual machine, it will fail.

  • If you get an error with grub, because you used the first method to create the MBR, you have to mount the installation or recovery DVD of Windows in your virtual machine, start it, and choose to repair it after the language selection.
  • If it fails, you can try to do it manually. Still on the installation DVD, type “ctrl-F10” to open a console, and type:
Bootrec.exe /FixMbr
  • You can also try different combinations of partitions you export with VBoxManage (sometimes it can require 1,2,3 which are diagnostic,recovery,windows)
  • If you get a BSOD “Stop: 0x0000007b” and the installation DVD fails to repair this, reboot natively under Windows, and merge the following registry file merge_ide.reg (you may have to set the main disk as IDE to boot Windows and another useless disk as ATA so that it installs the drivers, and then switch the main disk to ATA):
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\primary_ide_channel]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="atapi"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\secondary_ide_channel]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="atapi"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\*pnp0600]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="atapi"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\*azt0502]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="atapi"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\gendisk]
    "ClassGUID"="{4D36E967-E325-11CE-BFC1-08002BE10318}"
    "Service"="disk"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#cc_0101]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_0e11&dev_ae33]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1039&dev_0601]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1039&dev_5513]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1042&dev_1000]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_105a&dev_4d33]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1095&dev_0640]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1095&dev_0646]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1095&dev_0646&REV_05]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1095&dev_0646&REV_07]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1095&dev_0648]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1095&dev_0649]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1097&dev_0038]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_10ad&dev_0001]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_10ad&dev_0150]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_10b9&dev_5215]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_10b9&dev_5219]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_10b9&dev_5229]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="pciide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1106&dev_0571]
    "Service"="pciide"
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_1222]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_1230]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_2411]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_2421]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_7010]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_7111]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_7199]
    "ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
    "Service"="intelide"
    
    ;Add driver for Atapi (requires Atapi.sys in Drivers directory)
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\atapi]
    "ErrorControl"=dword:00000001
    "Group"="SCSI miniport"
    "Start"=dword:00000000
    "Tag"=dword:00000019
    "Type"=dword:00000001
    "DisplayName"="Standard IDE/ESDI Hard Disk Controller"
    "ImagePath"=hex(2):53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\
      52,00,49,00,56,00,45,00,52,00,53,00,5c,00,61,00,74,00,61,00,70,00,69,00,2e,\
      00,73,00,79,00,73,00,00,00
    
    ;Add driver for intelide (requires intelide.sys in drivers directory)
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IntelIde]
    "ErrorControl"=dword:00000001
    "Group"="System Bus Extender"
    "Start"=dword:00000000
    "Tag"=dword:00000004
    "Type"=dword:00000001
    "ImagePath"=hex(2):53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\
      52,00,49,00,56,00,45,00,52,00,53,00,5c,00,69,00,6e,00,74,00,65,00,6c,00,69,\
      00,64,00,65,00,2e,00,73,00,79,00,73,00,00,00
    
    
    ;Add driver for Pciide (requires Pciide.sys and Pciidex.sys in Drivers directory)
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PCIIde]
    "ErrorControl"=dword:00000001
    "Group"="System Bus Extender"
    "Start"=dword:00000000
    "Tag"=dword:00000003
    "Type"=dword:00000001
    "ImagePath"=hex(2):53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\
      52,00,49,00,56,00,45,00,52,00,53,00,5c,00,70,00,63,00,69,00,69,00,64,00,65,\
      00,2e,00,73,00,79,00,73,00,00,00

Sources - Story

First I tried the following tutorial:

http://geekfault.org/2011/10/14/lancer-votre-dual-booting-windows-dans-une-virtualbox/

But I had a problem for booting, and the installation dvd could not repair the install, so I tried this tutorial:

https://forums.virtualbox.org/viewtopic.php?f=28&t=33356

But I still had the same problem, a BSOD with error STOP OxOOOOOO7b.

Then I found on this thread some people having the same problem:

http://forum.ubuntu-fr.org/viewtopic.php?pid=4062086

Apparently one solved the problem by using an IDE disk instead of SATA in VirtualBox, but it didn't change anything for me. But another user said he followed:

http://support.microsoft.com/?kbid=314082

I did not find the .cab file to extract, but the .sys drivers were already at the right place, so I just merged the .reg file after rebooting to the native Win7, and then it worked also in VirtualBox, even with SATA !

Several years after I ran into more problems and found this complete tutorial:

https://forums.virtualbox.org/viewtopic.php?t=33356

software/virtualbox.txt · Last modified: 2014/11/29 10:03 by cyril
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki