Starting situation is an installation of Windows XP and Fedora 9 on the hard drive. The goal is to start Windows from Linux with the KVM virtualization solution. First step is to create a second hardware profile inside windows, this is necessary because windows should be bootable from the virtual machine and native hardware. Then it is time to try the first boot with the command line:

qemu-kvm -std-vga -m 512 -hda /dev/sda

This ends in the error message:

A disk read error occurred
Press Ctrl+Alt+Del to restart

The message is printed by windows boot loader which is installed inside the boot sector section of the windows partition. This error gives the suggestion that there is something wrong with the boot loader. There exists a project which provides a CD to fix the NT bootloader and to boot into installed windows versions without the bootloader on the disk. With the following command line it is now possible to boot windows:

qemu-kvm -std-vga -m 512 -hda /dev/sda -cdrom fixntldr.iso -boot d

This solution works without changing the windows boot loader and doesn’t destroy the native boot.

11 Responses to “Booting Windows XP from raw disk with Linux KVM”
  1. Can you explain in more detail what do you mean with “create a second hardware profile inside windows”? What do I have to do? Thanks

    ben Reply:

    You can do this in the “System Properties”-Window and the tab “Hardware”. There you can find a button which is called “Hardware Profiles”, where you can create further profiles.

    Steffen Reply:

    thanks, but I get errors like “Winnt_root\System32\Hal.dll missing or corrupt” and “Windows could not start because of a computer disk hardware configuration problem” on every point I choose.

    All the links to forum doesn’t work for me, coz Windows XP only could not be started via KVM…

    Maybe you have an advice for me?

    Here is my configuration KVM-79:
    Command: kvm -vga std -m 512 -hda /dev/sda2 -cdrom fixntldr.iso -boot d
    /dev/sda1 – boot partition with grub
    /dev/sda2 – Windows XP
    /dev/sda3 – Gentoo Linux

    With the command: kvm -m 512 -hda /dev/sda2 -boot c
    I’ll get this output to the console:

    exception 3 (0)
    rax 0000000000fa0d00 rbx 000000000000ffff rcx 00000000000003ff rdx 0000000000000000
    rsi 00000000ffff0000 rdi 000000000008789f rsp 0000000000007c00 rbp 000000000000ffff
    r8 0000000000000000 r9 0000000000000000 r10 0000000000000000 r11 0000000000000000
    r12 0000000000000000 r13 0000000000000000 r14 0000000000000000 r15 0000000000000000
    rip 0000000000000280 rflags 00023297……

    Steffen Reply:

    oh sorry I was completely wrong, with the command: kvm -vga std -m 512 -hda /dev/sda -snapshot it works perfectly with kvm-79

  2. I’m trying to get started with qemu and kvm but having some problems.

    When I try pretty much what Steffen had on my Ubuntu install (kvm -vga std -m 512 -hda /dev/sda -cdrom fixntldr.iso -boot d) then it goes to the grub screen, I select Windows, and then my new hardware profile. It starts to come up but then I get “A problem has been detected and windows has been shut down….”. There’s then a generic warning about how this could be caused by disk corruption or a virus and then it shows STOP and a few memory addresses. Do you have any ideas what I may be doing wrong?

    This is XP sp3 I’m trying to boot from kvm 79 under 2.6.28-4

    ben Reply:

    Hi Matt,

    you have to make sure that the qemu boots the iso file. You will get a boot menu, where you have to chose the partition where your windows is installed.

  3. What do you do about reactivating windows? I created the second hardware profile and was able to boot windows, but now I need to reactivate. When I boot natively, will I have to reactivate again?!?

    ben Reply:

    Hi steve, sorry I didn’t had this situation.

    Steve Reply:

    This helped me solve my problem:

    http://mazimi.wordpress.com/2007/07/11/getting-around-windows-activation-when-virtualizing/

  4. Nice tutorial. I am trying to do this with a dual boot configuration with windows 7 and Open Suse, both x64 bits and I get to load the grub and even the windows system itself, but I see only a message “Windows is loading files”…then it takes me back to the grub.

    Any idea how I could solve this? Thanks

    ben Reply:

    Hi,

    this tutorial doesn’t work with windows7. But please keep me posted when you find a method to boot win7 natively!

    cheers
    ben