You are not logged in.

#1 2016-05-24 20:04:07

Baraclese
Member
Registered: 2008-05-28
Posts: 48

Creating a VM of your existing Windows installation

Hello all, just wanted to share a bit of my own excitement with you.

At work I received a new laptop. I downloaded and ran the disk2vhd tool from microsoft on my old work laptop to create a vhd image of my windows 7 pro installation (it does this while you're in windows). Installed Arch Linux on my new laptop. Copied the vhd image over and executed it with qemu. To my surprise it booted up without any problems. That was a few weeks ago, in the meantime I converted the vhd image to the native qemu format qcow2 with the qemu-img command and I manage my windows vm with the virt-manager tool. I can share folders between windows and linux via samba. I also installed a ssh server in windows via cygwin and sync files from linux to windows with rsync.

This is a very convenient setup and a huge step up from a dualboot. Pretty exciting times...

Offline

#2 2016-06-16 22:30:01

mahatman2
Member
From: Baton Rouge, LA, USA
Registered: 2010-03-04
Posts: 46
Website

Re: Creating a VM of your existing Windows installation

Hi Baraclese,

Could you share some specifics of your method? I've tried creating a VHDX of my current Windows install (just C:\ though to save space) and it's not booting with qemu. I must admit I'm very new with qemu; I usually use VirtualBox.

I'm glad to see you've been successful in this area; it's something I hope to do very soon! (I'm so over Windows.)

Deets: Windows 10, 2 hard drive (OS/DATA; I just need to image the OS drive), but with a couple extra partitions for Windows' weird backup stuff. Maybe that's the problem?


Clever Linux quote.

Offline

#3 2016-08-17 13:42:51

Baraclese
Member
Registered: 2008-05-28
Posts: 48

Re: Creating a VM of your existing Windows installation

Hello, sorry for the late reply.

You do need to include the boot partition in your VHDX file, not just C:. You probably have a UEFI install of Windows 10 in which case I don't know how to tell QEMU to boot the VM. You probably need to install the https://www.archlinux.org/packages/extra/any/ovmf/ package, so that you have UEFI available.

In case you don't have a UEFI install of Windows you can use a command such as this to boot the VM:

qemu-system-x86_64 \
	-daemonize \
	-enable-kvm \
	-cpu host \
	-smp 2 \
	-m 4G \
	-device virtio-serial \
	-chardev spicevmc,id=vdagent,name=vdagent \
	-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
	-vga std \
	-soundhw hda \
	-net nic,model=rtl8139 -net user,hostname=win7vm \
	-name Win7Pro \
	~/Downloads/win7pro.vhd

For a UEFI install you probably need to add some more switches to the qemu invocation.

Last edited by Baraclese (2016-08-17 13:43:42)

Offline

#4 2016-08-22 02:18:48

mahatman2
Member
From: Baton Rouge, LA, USA
Registered: 2010-03-04
Posts: 46
Website

Re: Creating a VM of your existing Windows installation

Thanks for the info! I do have a UEFI install of Windows, so I'll have to keep looking....in the meantime I've just taken the dual-boot plunge wink

I'll try this out soon (lazy tonight) and see if I can get it working; I'll reply with the results!


Clever Linux quote.

Offline

#5 2016-08-23 16:36:03

bullet
Member
Registered: 2016-08-04
Posts: 18

Re: Creating a VM of your existing Windows installation

That's rather impressive, maybe the MS tool is doing magic because I would've said it's pretty much impossible to boot a disk image in Qemu/any other emulator because of hardwared differences.

Offline

#6 2016-08-25 08:29:25

Baraclese
Member
Registered: 2008-05-28
Posts: 48

Re: Creating a VM of your existing Windows installation

Since the virtualization layer is presenting standard hardware to Windows it can simply use the drivers it ships with, no magic necessary there. For better performance you can then install the VirtIO drivers for Windows (https://fedoraproject.org/wiki/Windows_Virtio_Drivers).

Offline

Board footer

Powered by FluxBB