Run physical Windows installation as virtual machine

How to run a physical installation of Windows in a virtual machine without loosing the ability to still run this copy natively?

I would like to underline that we are talking about running the same copy of Windows both physically and in the virtual machine. Any idiot can install Windows in a virtual machine, as well as convert an existing physical installation into a virtual machine. My goal is to have the same single copy of Windows to run both in a virtual machine and physically. After that we will also make the task even harder – to run two copies of Windows simultaneously from a single HDD drive. Why do I need this? Well, I’ll keep the answer till the end of this video. Meanwhile I would like to tell that some people in forums insist that running the same copy of Windows physically and virtually is not possible, and this tutorial is made to prove it is possible. To follow this tutorial, you need to be familiar with creating partitions, formating disks, working with boot sectors. I see no rocket science here, but some people insist this is some advanced IT magic only nerds can conjure. Well, Apple carters for this group of people not wanting to learn anything at all, so let them be. Let’s start. First you will need a PC with a processor that has visualization instructions. Most modern processors have them, and you may need to enable the feature in BIOS. Different BIOSes have it in different places, here’s Lenovo, here’s Asus, and here’s some fancy UEFI bios. Enable the visualization technology options in BIOS. My PC hard drive has an MBR boot partition with Windows. I want to keep loading this Windows normally, and also to load it as a virtual machine. The first candidate for such task is Linux of course. Several free visualization tools exist for Linux, the most popular being XEN, KVM and VirtualBox. Xen is a very powerful bare metal virtualizer. Unfortunately, it is tailored for Unix systems, and even though it can run Windows, it’s not too good at it. The second candidate is VirtualBox. It runs Windows very well. VirtualBox manual has a section, where it tells you how to make a bogus virtual drive that actually maps to a physical partition. I won’t go into deep detail here, but booting Ubuntu from external USB hard drive, I was able to run the physical Windows installation on internal HDD in a virtual machine under VirtualBox. KVM, which natively supports physical partitions without any tricks, also works. So I decided to complicate the task – boot two copies of Windows from the same internal drive simultaneously: either of the copies must be able to boot natively or inside a virtual machine from the other copy. So I would get two working copies of Windows on the same computer. Unfortunately, VirtualBox cannot be used in this scenario. Whatever I tried, it starts to boot the physical copy and then hangs. There’s no KVM for Windows, so we have to turn to the big giant – VMware Workstation. VMware also supports booting from physical drives. For my purposes, I created another partition on the internal HDD, formatted it to NTFS, created a virtual drive VHD container, installed another copy of Windows inside this VHD, and configured BCD store to boot from it. VHD drive has nothing to do with virtual machines, it’s just a convenient way to install Windows as starting from Win7, Windows supports VHD boot. So both copies of Windows – one on drive C: and one on say drive D: are on the same HDD and use the same boot sector and boot loader. If you run VMware in either of the Windows copies and try to boot the other copy of Windows, VMware will say the drive is already in use and fail to boot.

The physical disk is already in use.
Cannot open the disk or one of the snapshot disks it depends on.
Module DiskEarly power on failed.
Failed to start the virtual machine.

The problem is not solved by removing drive letter in disk management. I think this is the problem that lead the forum posters to the conclusion this won’t work. Well, I found the workaround. The problem itself is really simple – both Windows copies use the same boot sector partition. To save time and effort, I just took Windows 7 installation DVD, removed everything except the boot loader, and configured the BCD store to boot from drive C:. I saved the image, so now I have a 17 megabytes image with boot sector. Then just mount this ISO as CD in VMware and configure the virtual machine to boot from the CD. The CD boot sector will boot the physical copy of Windows from drive C: in the virtual machine. If you experience errors, do not forget to disable the first Windows disk in the second. That means, if you boot Windows from C:, and have another copy on D:, remove drive letter D: in disk management. If you are booting from VHD, you probably will also need to reconfigure swap file location and remove any previous swap mentions from the registry. Also I recommend to stick to MBR partitions only. MBRs are accepted by virtual machines, while EFI support is relatively new. If you did everything correctly, you will be able to boot two systems simultaneously. As licensing goes, Microsoft has a very obscure policy about it, explicitly saying you can use the same license when converting a physical machine to a virtual one, however, each virtual machine must have a separate licence. Nothing is said what happens when you jump from physical to virtual and backwards. However, VMware handled licensing very well, and I had no problem with it in the 6 months I’ve been using this setup. Probably you just shouldn’t fire up two Windows installations with the same license simultaneously, but you can use them one at a time. So why do I need all this? Well, it’s convenient. On the left display I have my work system in a virtual machine, on the right display I have my personal machine running physically, but I control both with a single mouse and keyboard without KVM switch, and even copy-paste works between the two machines. When I go home, I reboot the computer and it boots my work copy of Windows physically. This is a way out if your company or school have restrictions on running programs or accessing the internet, but you still need freedom, without attracting too much attention and still being able to monitor what’s going on your working PC. Of course you can bring a personal laptop, but in that case everyone around you will know how much of your working time you spend on your personal laptop. And in this scenario, one display runs your working machine which is in connected to the domain with restricted USB, Internet and all those paranoid perversions of your beloved security officers, and on the right you have your own machine that you can control, and say attach a 4g modem to get unrestricted Internet. Beware though. Such setup is really easy to figure out remotely as your machine will parade its virtual hardware to anyone interested. So if your company has really tight security policies, maybe it’s a better idea not to risk your work and future career. This setup may get you in real trouble with your employer. I warned you.

Leave a Comment