Ever realized how hassling the Windows file structure is? You install Windows in drive “C:” and that drive is super cluttered. Ever wish you could install more than two or three instances of Windows in the same PC? Fancy opening a drive on a PC and finding just a single file labeled “Windows”, instead of a whole lot of directories? Well, now you can! Install Windows on a VHD! (And no, that’s not the tape thingy you used in the ‘80s).
For whatever reason you decide to install Windows on a virtual hard disk, here’s the how. Do not that only Windows versions from Windows 7 (and its Server counterpart) can successfully boot from a VHD (Personally, I install any new versions of Windows 10 (1709, 1803, 1809 etc.) on a VHD and try it out a few days before actually installing onto my Workstation’s primary disk). Here’s what you’ll need; the Windows setup disc, already installed version of Windows 7 (only VHD) or Windows 8/10 (VHD+VHDX) or Windows their server counterparts and finally a tool called “EasyBCD”.
|EasyBCD| (Password is “hellohelp”)
One more note before we proceed: this is written assuming that you have at least a bit of knowledge at installing Windows and managing computers. Proceed at your own risk. I am not responsible for the loss of your data in case you format any drives. You have been warned!
Open “Disk Management” (the desktop app. Not the CLI version). Create either a VHD or a VHDX file. (Each has its pro’s and con’s. VHD is best if you want to install Windows 7 on the created VHD. VHDX is resistant to power outages. But VHD files are backward compatible. On the other hand VHDX files can be larger than 2TB. Your choice which!) The size is a careful consideration, as is the location and whether it’s “Fixed” or “Dynamic”. The size should be enough to store Windows and all its files (20GB<). Don’t make it too large as it occupies all space in the residing drive at runtime (It grows to maximum size when Windows is running from the VHD). I’d recommend Dynamic for tight-storage users and fixed for performance-heads. For the use of this tut, I’ll create a 32GB Dynamic VHD file.
Next, initialize the disk as GPT (it doesn’t matter whether you have BIOS or UEFI, GPT VHDs work for both. 🙂 ).
Then format it as “NTFS” and give it a label and a mount point. I’ll be labeling it “TEST” and mount It under “W:”. Notice how the icon of a VHD is blue.
The next few instructions are explained in detail in this post.
Mount the Windows install disc and find the “install.esd” or “install.wim” file.
Open a CMD windows with admin privileges. Enter the following command:
“DISM /apply-image /imagefile:O:sourcesinstall.esd /index:6 /Apply-Dir:W:”
A few pointers:
⦁ The location of the “install.esd/wim” file should replace “O:sources…..”.
⦁ The index no. is based on what edition you want (explained in the linked post).
⦁ The apply directory has to be changed to reflect the mount point of the VHD.
After a few seconds (or minutes), it should say “Operation Completed Successfully”. Now unmount the VHD file from disk management.
Install “EasyBCD”. Open the tool and navigate to add new entry. Select “Microsoft VHD”. Change the name to whatever you want. Point to where you saved the VHD file. Then click “add entry”.
Go to the “Edit Boot Menu” tab, untick “Use Metro Loader”, set enough time for you to select an entry and finally click “Save Settings”.
Done! Reboot your PC. Just after POST, it’ll ask you what you want to boot. Select the instance of Windows installed in the VHD. If you did all the above steps right, Windows will begin setting itself up!
Note: ACPI S4 sleep mode (Hibernate) won’t work from within the VHD Windows.