Dual Boot Windows 8 from VHD using Windows Setup

Author by Shannon Fritz

UPDATE: I've added information about the new Consumer Preview build as well as how to Remove the Dual-Boot option when you're done testing it.  This process does work with the Final / RTM of Windows 8 as well.
Are you running Windows 7 and have things just the wayyou like them, but you’re really curious to see how Windows 8 looks and feels? Using this method, you can boot your computer between your existing Windows 7 installation or Windows 8 without needing to sacrifice disk space! Using a Dynamic Virtual Hard Disk (VHD), you can install Windows 8 to a single file that is stored on your Windows 7 file system, and then boot directly from that Virtual Hard Disk.  This lets you choose to load either your existing OS or the new Windows 8 at boot time. You are not doing an in-place upgrade and you are not doing a rebuild. It’s just a new install of Windows 8 and you don’t have to trash your existing setup to do it. A couple notes before getting started...
  • If you are using BitLocker on your windows 7 Computer, do not create the Windows 8 VHD on your BitLocker encrypted volume.  If all of your drives are encrypted, then you won't be able to use Boot from VHD.  Pausing BitLocker Encryption is not a workaround.
  • If you are using Windows XP as your current operating system, you cannot Boot from VHD, so this method of Dual-Booting is not available to you.  You can only (officially) use this on an existing Windows 7 or Windows 2008 R2 computer.
  • When making the VHD, make sure the "maximum size" that you specify is less than the actual size of your disk.  For example, if you have a 60GB SSD drive, make sure the VHD Max size is less than 60GB and not the 100GB I use in the example below.
Let's get started!  If you haven't already, download Windows 8 here and browse the BuildWindows.com web site. On the computer which already has Windows 7 installed, boot from the Windows 8 media and you’ll launch the installer. Before clicking “Install Now”, hit Shift+F10 and the WinPE command prompt will appear. Note: If you want to boot from USB instead of burning a DVD, you can use the very handy WUDT tool from CodePlex which will make a bootable USB stick from the ISO for you. It’s time to create the VHD that will be your Windows 8 drive. Run “diskpart” from the CMD window, then issue the following commands to diskpart:
  1. list disk ... This shows your currently attached hard disks. In this example I only have one, Disk 0.
  2. select disk 0 ... You want to select the disk where you’re current operating system (Windows 7) is installed, so if you have multiple disks available, you might use a different number.
  3. list vol ... Show all the volumes that exist on that disk. Existing installations of Windows 7 will usually have a 100MB volume that is the “System Reserved” partition (used as the boot loader and leveraged by BitLocker) and then the actual OS volume is much larger. In example you can see my Windows 7 volume is actually assigned to letter D (although when booting normally it would be my C: drive).
  4. create vdisk file=d:Windows8.vhd maximum=100000 type=expandable ... This creates a Dynamic VHD that can grow to ~100GB in the root of my Windows 7 partition.  If your hard drive is smaller than 100GB then be sure to use a smaller value for maximum that is less than your actual disk size.
  5. select vdisk file=d:Windows8.vhd ... after selecting this vdisk, the following commands will apply to it
  6. attach vdisk ... The VHD will be mounted and the disk will be available to the windows installer
  7. exit ... we’re done with diskpart
All those commands will look like this: Now you can close the Command Prompt and return to the Install Windows wizard and click Install Now. When asked where you want to install Windows, you should see a new Disk 1 listed with Unallocated Space. You’ll notice that when you select this disk the installer will tell you that “Windows cannot be installed to this disk” but the Next button is enabled. If you click Next, it will in fact install Windows there just fine. Once the installation is complete and your computer reboots, you will see a new boot loader that asks you to “Choose an operating system” and you can select either the new install of Windows 8 or your previously existing OS. The first time this appears you get about 3 seconds and it auto loads Windows 8 to finish the setup. On subsequent reboots it’ll give you 30 seconds before auto selecting it. Now you can browse around Windows 8 on your Native hardware! You can also still access files on your Windows 7 disk. Open Explorer and you’ll see it appear as a different drive letter (D: in this case) and you can browse around and copy/modify files as you wish. Notice that the D: looks full? This is because the VHD you created for Windows 8 is reporting its maximum size instead of its actual size. When you boot into Windows 7 you’ll see the VHD is actually only about 8GB. Are you all done with Windows 8 and can’t figure out how to shut down? Take your mouse and hover over the start button, or touch your mouse cursor to the bottom left corner of the screen and a small start menu will appear. Click on Settings, then Power and choose Shutdown. Now you can enjoy the best of both worlds...N'joy!
UPDATE: Windows 8 Beta
Microsoft released the Consumer Preview build of Windows 8 and I am happy to tell you that the instructions above work exactly the same.  I expect it will continue to work with all future builds of Windows 8 as well. The boot screen is a little different now in display but it otherwise works like the Developer Preview. One other note, the option to Shutdown in beta is no longer on a Windows button on the left.  Instead bump the bottom right corner of the screen and you'll see a new Settings side bar where Power -> Shutdown can be found.
UPDATE: How do you remove the Dual Boot option when you're done with it?
Removing the Windows 8 Dual-Boot option is pretty straight forward.  Just boot into your Windows 7 OS and start MSConfig.exe.  From there, select the instance of Windows 8 and click Delete.  Make sure you do this from the OS that is installed on the disk and not the VHD! After you delete it and reboot, you can delete the Windows8.vhd file.

Shannon Fritz

Infrastructure Architect & Server Team Lead