Keith C. Perry on 9 Dec 2018 12:50:05 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Virtualize a Windows 10 physical drive from a laptop


This is something I do all the time and you are on the right path.  I'll outline the process and then we can take it offline since there are some windozey things you have to do and may get jammed up on.

1) You MUST sysprep your Windows system into order to "move" it into a virtual environment (or to new hardware generally speaking).  You'll want to choose OOBE and also the "Generalize" checkbox.  Quick Google-fu gave me this for you https://thesolving.com/server-room/when-and-how-to-use-sysprep/

The other important thing here is that for the shutdown option you want to shut the system down (poweroff).  You do NOT want to reboot otherwise you'll have to do the process again.

NOTE: this process can and WILL fail eventually (there is a counter) if you sysprep your Windows systems often.  However, there are two registry keys that will allow you to reset the counter.  If you run into that let me know and I'll sent those to you if you don't feel like searching around for it.

2)  Now that your computer is sysprep'd now you can capture the image.  The most space efficient way to do that is:

qemu-img convert -pO qcow2 /dev/sda /mnt/mysystem.qcow2

The "p" will give you progress on the conversion.  I'm using /dev/sda as the source drive and "/mnt/mysystem.qcow2" for the VM file (/mnt would be some mounted location where you can store the file).  In terms of LiveCD for this I've added a bunch of packages (including qemu progs) to my USB stick for Ubuntu based distro's bunch if you don't want that headache I know at least Fedora 24's Live CD came with qemu.  As along as you have internet access you could certainly use any Live CD you want and then install the qemu.  For what its worth, this will work if you boot the Live CD into ram.  I tend to do that when I'm imaging a number of systems but its a good idea anyway to make sure you don't mess up a bootable USB drive.

3) Clone close your system before launching...  Two reasons for this 1) you can make sure it works and then customize it if you want to change something 2) you can keep this file as a reference point.  Also, please, please, PLEASE make mysystem.qcow2 READ ONLY and then,

qemu-img create -f qcow2 -o backing_file=/mnt/mysystem.qcow2 mysystem-1

My own standard is to not use .qcow2 for clones that way I know there is a backing file to protect.  At this point you can launch your VM with something like the command you initially posted.  If do something you're not really happy with you can start over- actually you can make as many systems as you want by making addition clones.  You can also resize the windows partitions, delete the recovery partitions and even update the image with other files (such as drivers) if would want to burn it back down to new bare metal.  When you have everything the way you want you can convert it to a stand along container with

qemu-img convert -pO qcow2 mysystem-1 mysystem-vm.qcow2

and you'll be good to go.  :D

Good luck!/


~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Keith C. Perry, MS E.E.
Managing Member, DAO Technologies LLC
(O) +1.215.525.4165 x2033
(M) +1.215.432.5167
www.daotechnologies.com


From: "K.S. Bhaskar" <ksbhaskar@gmail.com>
To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
Sent: Sunday, December 9, 2018 10:29:48 AM
Subject: [PLUG] Virtualize a Windows 10 physical drive from a laptop

I want to virtualize the Windows 10 image from a laptop. I used dd from Linux booted using a USB drive to grab an image of the entire hard drive, and then qemu-img on a Linux laptop to convert it to a qcow2 format. When trying to boot it, no matter what I do, if I don't get an error message, I see a momentary screen with the words “Guest has not initialized the display (yet)” followed by the screen below which hangs for ever (or at least overnight). I have tried pretty much every command line option that seems to make sense from man qemu. I have also tried it on the unconverted .img file Here is a representative command line:

qemu-system-x86_64 -enable-kvm -smp cpus=2 -cpu host -m 4096 -vga std -net nic -net user,hostfwd=tcp::3389-:3389 -smbios type=0,uefi=on -hda /run/media/bhaskar/97b5ea53-d25b-42e6-9ecb-690163d783db/Windows10.qcow2&

This is on Arch Linux, and I can also try Ubuntu 18.04 if that might make a difference. Suggestions greatly appreciated.Thank you very much.

Regards
– Bhaskar

image.png

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug