How to use a VHD to dual-boot Windows 8 on a Windows 7 PC
Update, July 14, 2013: I have tested the steps in this article with the Windows 8.1 Preview and can confirm that the procedures described here work properly.
Update, August 17, 2012: I have tested the steps in this article with the Windows 8 RTM code on multiple test systems and can confirm that everything works just as described here.
My portable PC of choice these days is an ASUS Zenbook UX31E. It’s a wonderful little machine—light, fast, fun to use, and a great example of what’s right with the whole Ultrabook category.
I wanted to try Windows 8 on this machine, but I didn’t want to mess up a perfectly good Windows 7 installation. This is, after all, a machine I use for work, and Windows 8 is still a new operating system. Before I commit to it, I want to be sure everything works well.
The Zenbook has a 128GB SSD, which is fine for a secondary work PC but not enough to split in half for a conventional dual-boot setup. And there's no way to upgrade that built-in drive. After a few milliseconds of thought, I rejected the idea of trying to shrink my existing disk partition so I could pull that off.
And then it struck me: Wait a minute. I can boot Windows 8 from a virtual hard disk on this machine! And 30 minutes later, that’s exactly what I was doing.
I still have a single SSD with a single partition. But this is what I see at startup:
The actual steps for creating a virtual hard disk (VHD) and installing Windows 8 on it are very simple. The hardest part, in my experience, is wrapping your mind around exactly how this procedure works. So in this post I’m going to explain everything in detail, in the clearest, simplest language I can. Follow along, and I am confident it will work for you too.
Disclaimer, right up front: This works for me. I’ve tested it on several PCs, and I’m confident enough to write about it. But I haven’t tested it on your hardware. You should make a complete backup of your PC (preferably as a system image) before you try the procedures I describe in this post. In fact, you should have a complete backup of your PC even if you don’t try this. OK?
First things first. To make this work, you need the following ingredients:
- A desktop or notebook PC running Windows 7 Ultimate or Enterprise (preferably 64-bit). The Boot from VHD feature does not work on other versions of Windows 7. If you’re running Windows 7 Home Premium or Professional, you can’t do this.
- Windows 8 installation media (32-bit or 64-bit). You can use any edition of Windows 8. If you have a DVD, use it. MSDN/TechNet subscribers can download ISO files from those sites. Microsoft makes a free 90-day trial version of Windows 8 Enterprise available as well. Get details about these options here .
- The Windows 7 USB/DVD download tool. which is available for download here. (Don’t let the name fool you—it works just fine with Windows 8.)
- A 4GB (or larger) USB flash drive or a DVD. I highly recommend using a USB flash drive as your installation media. It’s faster, and it works on any modern PC.
- At least 20GB of free space on a local hard disk or SSD. If you plan to do more than tinker with Windows 8, I recommend that you have at least 60 GB of free disk space, plus enough extra disk space to accommodate a paging file equal in size to the amount of RAM in your PC.
And one extra caution: If you've protected your system drive with BitLocker encryption, stop right now. This will just make you cry.
OK? We good? Then continue.
Download the Windows 8 Release Preview ISO file and use the download tool to make a bootable USB flash drive or DVD:
You are now ready to begin the process of creating a virtual hard disk and installing Windows 8.
Page 2: Creating a virtual hard disk -->
It is possible to use the command line Diskpart tool to do everything I describe in this how-to. If you’re comfortable with that, you are a ninja. You don’t need me.
The procedure I describe here uses the absolute minimum number of command-line steps. For this portion of the job, we’ll use the Disk Management console.
Open Windows Explorer, right-click Computer in the navigation pane on the left side of the window, and click Manage in the shortcut menu. That opens the Computer Management console.
Click Disk Management in the pane on the left side of the window and wait until you see all currently installed disks in the contents pane, as shown here:
As you can see, this machine has a single hard disk (with the tiny 100MB boot partition and a much larger partition used for Windows and all data files).
Click the Action menu and you’ll see two VHD options. Click Create VHD to get started.
Click Browse to choose the location where you
want your VHD stored, and give it a descriptive name. (The name in this screenshot includes CP, to indicate that I originally did this with the Consumer Preview. For the RTM code, I recommend you use Win8 or Win8-RTM.)
In the example shown here I created a VHD folder on the C drive because it’s easy to remember, but you can put the VHD file anywhere you want and give it any name you want. Specify a size (I’ve used 60GB here). In Windows 7, you can choose between a Dynamically expanding virtual hard disk or a Fixed size VHD. Which one you choose doesn’t really matter; just make sure you have enough room on your current physical disk to accommodate the space you specified.
Click OK to create the VHD file and continue. Watch the progress bar in the lower right corner of the Disk Management console to see your virtual disk being created. It only takes a few seconds for a dynamically expanding disk; a fixed size VHD takes several minutes. When it’s done you’ll see a new entry in the Disk Management console.
As far as Windows is concerned, that’s a brand-new 60GB disk you’ve just installed. You don’t need to initialize it or format it or do anything with it at this point. Make a note of the exact path and filename of the VHD you created; you’ll need it shortly. You’ve now done enough to move on to the next phase.
Plug in the bootable USB flash drive you created earlier or insert the bootable DVD installation media and restart your PC. Do whatever it takes to start your computer using that bootable media. When you get to the Windows 8 setup screens, you’re ready to move on to the next phase.
Page 3: Installing Windows 8 on your VHD -->
<— Previous page
If you’ve installed Windows 8 before, the first few steps here will be straightforward. (In fact, it’s pretty close to the Windows 7 setup experience, too.)
Pick a language (U.S. English is the default), click the Install button, and enter the Windows 8 product key. (Yes, you must enter a valid product key. Unlike with Windows 7, you can't leave this box blank. Also note that your new installation will be activated immediately when you restart.)
You have now reached the point where you need to tell Windows that you want to do a custom installation on your new virtual hard disk. But there’s a slight problem at this point: The Windows 8 installer doesn’t know about your virtual hard disk yet. So, just for this one step, you need to dip down into the Windows Command Prompt.
Press Shift+F10 to open a Command Prompt window, where you will type some simple commands. Here’s what it looks like:
Before you can finish this step, you need to know the drive letter that Windows 8 Setup thinks your VHD file is stored on. In the Command Prompt window, type dir C: to confirm that Windows 8 Setup sees your VHD file. If you see the VHD folder, great. If not, try dir D: , dir E:. and so on, until you locate the correct drive letter. (In my test system shown here, the 100MB system partition was recognized as drive C. and my VHD file was located on drive D. with a full path of D:\VHD\win8-cp.vhd.)
After confirming those details, type diskpart and press Enter to open the command-line disk partitioning utility.
At the DISKPART prompt, type the following commands, pressing Enter after each one:
select vdisk file= c:\vhd\win8-cp.vhd (substitute the full path to your VHD file after the equal sign)
You can now click the Custom option in the Windows 8 setup dialog box. That takes you to a screen like this one:
Pick the new “drive” you created in the previous step and ignore the bogus error message that says Windows can’t be installed there. It can indeed. Click Next to continue.
You can now complete setup, which will proceed exactly as if you were using a physical hard disk. When you’re done, you’ll have a startup menu where you can choose from Windows 7 or Windows 8, with your most recent installation (Windows 8) as the default. You can use the Msconfig utility to change the default OS back to Windows 7. If you do, the startup menu will change to the plain white text on black background version. If Windows 8 is the default, you get the Metro style graphical boot menu.
You still have only a single physical disk and a single partition, but if you boot to Windows 8 and look in Windows Explorer you’ll see two drives there:
As far as Windows is concerned, that 60GB C: drive is the real thing, even though we both know it’s just a file pretending to be a hard disk.
And that’s it. When you’re done with your testing, you can blow away the Windows 8 installation by booting into Windows 7 and doing two things:
- First, delete the VHD file you created earlier.
- Then, open Msconfig, click the Boot tab, and delete the entry for Windows 8.