Windows 8 on a Virtual Hard Disk (VHD)

Now now, don’t get me wrong. I am not recommending and writing about installation of Windows 8 over Linux. Infact, I am not recommending you guys to install Windows 8 (W8) at all except if you like me are developers and creators at heart and would like to do some applications for Windows Phone 8 (WP8). Microsoft being the good guys (deeply sarcastic if you don’t get me) have released a 1.5GB download for tools related to WP8 development. It also includes a gratis version of Visual Studio 2012 Express edition!

One day, I was just thinking, hey maybe I am biased. WP8 is not as bad and I should port all my Android applications to it. It is not a big task anyways. So, I pumped up my Windows 7 (W7) machine and was about to download the tools when I read through the requirements for the WP8 development tools. A WP8 professional x64-bit was needed to run them. And NO. I am not going to turn my desktop into a big PHONE. I will never allow that to happen till I am alive. And I don’t want to re-partition my HDD and I don’t want to buy a separate HDD to run WP8. So there I was, wanting to help Microsoft with 5 great apps and stuck at the first step.

The first thought was to install W8 in virtual box. But WP8 emulator needs Hypervisor-V support and that could take a lot of power from my PC and most probably not run properly as well. My W7 machine is very capable of running but I don’t want the extra overhead as well as lost cpu cycles because of running WP8 simulator (virtual box->W8->Hypervisor-V->WP8 emulator). I mean seriously, why Microsoft do you need to make a phone out of the desktop for creating WP8 products. Anyways, I would like to run W8 on bare metal but still not mess up with my existing FS or HDD. So I did install W8 on a Virtual Hard Disk (VHD).

VHD is a special kind of file format (well basically a blob) and the best part is that Microsoft supports it (of course it will, the specifications are made available under the Microsoft Open Specification Promise). So my whole install of W8 is just in a single file. No messing with anything else in the system setup. And I can boot up from that VHD on bare metal and run W8. When I am done, I will just have to restart and I will be in the familiar and trusted W7 environment. I don’t like the dual boot entries but hey, we need to let some slack to Microsoft OK.

So, how do we go about doing it. I am writing it down but since I am not in front of my W7 computer, you need to find the relevant menu items yourself (no spoon feeding). In W7, go to computer management, disk services and open it. Now from the menu select create a VHD. Select a location where you want it, save it with a file name, give it some size (100GB) and select dynamically expanding so that you don’t have to give it all the 100GB at once. The file will increase in size as and when it is needed but never expanding beyond 100GB. Once created, select attach VHD and select the file so created. Now you will have an extra drive in My Computer. It will be empty though.

Now put in your W8 Pro x64 installation DVD and let it run the setup. Give the VHD HDD attached drive (G: or something) and let it install W8 there. Reboot and W8 should have created a nice entry. Continue with the installation and you are all done. In some cases, it might happen that the VHD is not attached when the W8 reboots to continue with the installation. In that case, on the select drives screen, press CTRL+F10 and you end up in command line.

Now use diskpart to do the job. You will definitely land up in DISKPART prompt.

C:\> diskpart
DISKPART> sel vdisk file="<file location>"
DISKPART> attach vdisk

There you go. Now enjoy the W8 installation to create WP8 stuff. You can still access all your W7 files and folders. And W8 will not mess up with existing system. Removing W8 is also easy! Just delete the VHD file (after detaching it of course). So there my readers, you get what you want without being dirty. ENJOY!