How to use a VHD to dual-boot Windows 8 on a Windows 7 PC

How to use a VHD to dual-boot Windows 8 on a Windows 7 PC

Summary: Updated for Windows 8 RTM and Windows 8.1 Preview: Want to try Windows 8 but don't want to mess up a perfectly good Windows 7 installation? Follow these simple step-by step instructions to to run Windows 8 from a virtual hard disk.

SHARE:

<— 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)

attach vdisk

exit

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.

Any questions?

Topics: Operating Systems, Hardware, Microsoft, Software, Windows

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

71 comments
Log in or register to join the discussion
  • Parallels workstation makes it a snap...

    It can do this on any version of Windows 7 with enough memory and disk space. I believe this can happen on Oracle VirtualBox, but have not done this successfully.
    DAMANgoldberg
    • but VHD boot should have better performance

      what with it being a boot image rather than a virtualised image as such...
      mary.branscombe
    • Not the same thing at all

      First, Parallels Workstation costs extra money. This doesn't.

      Second, it introduces additional third-party software into the equation.

      Third, it doesn't allow direct access to hardware, the way Direct Boot to VHD does.

      Virtualization is great for certain scenarios, but Direct Boot to VHD is a much cleaner solution, with fewer complcations.
      Ed Bott
    • Virtual Box is just as good as VMware Workstation

      And it's 100% free (untill Oracle want to start charging for it) :( . Win 8 does not have any VM tools yet, but it runs fairly good considering how clunky the OS is designed. I had at one point both Windows 7 VM and Windows 8 consumer preview, running on Virtual Box on my Mac Mini. Runing both osx and windows allows files to be shared bettween the too via Samba. I can run both Mac apps and legacy windows apps at the same time. But win 8 was so awfull I had to remove it. i would rather put vista VM on it than win 8 any day.
      Bakabaka
  • The reason I went the other direction

    I did the shrink and install route because I didn't want a clean Windows 8 install, I wanted an upgrade install dual booting with Windows 7 (which I haven't needed to go back to yet) - so I shrunk and cloned the 7 partition, but I did put in a larger Kingston SSD to make room
    mary.branscombe
  • I've seen this before...

    Here: http://www.hanselman.com/blog/GuideToInstallingAndBootingWindows8DeveloperPreviewOffAVHDVirtualHardDisk.aspx

    And I'm pretty sure you can do it with Windows 7 Home Premium (that's what I did)
    javierazabache
    • According to the specs...

      Microsoft says the feature is only supported on Ultimate and Enterprise.

      See the Direct Boot from VHD entry in this chart:

      http://windows.microsoft.com/en-US/windows7/products/compare

      As for Scott's post, I have seen it before, along with a dozen other posts that tackle the same topic. This is my independent work and a different presentation. There's plenty of room in the world for multiple people to put their own stamp on ideas.
      Ed Bott
      • Thankfully Windows 8 Pro supports Boot to BHD.

        Thankfully Windows 8 Pro supports Boot to BHD.

        To be clear, Win7 Home Premium and Pro support creating and attaching VHDs but not booting from them.

        Pity, as I wanted to try this simple way to Windows 8 on my Win7 Home Premium PC too.
        bradavon
      • Win 7 Pro

        despite what others are saying I concur with Ed it doesn't work on Pro, you can create and attach the VHD but Win8 'next' box remains greyed out when the vhd is selected for install.
        Jaipo
      • VHD

        Ed, can this be done on a USB Hard Drive?
        txmadmansatx
      • Create the VHD in diskpart...

        When you open diskpart from the win8 installer, create the VHD there. Win7 Pro won't boot from VHD, but your article is not about booting Win7. It is about booting Win8 CP which does boot from a VHD.

        I created and attached the VHD in diskpart. installed with no issues and have a dual boot with Win7 Pro. Only Win8 boots from the VHD.

        Command is: CREATE VDISK FILE="C:\VHD\win8-cp.vhd" MAXIMUM=60000

        In order for that to work, the C:\VHD directory must first exist.

        WIN8 boots to the OS selection screen and then I can select which OS to boot.
        Freddy McGriff
  • And they say Win8 is for Consumers!

    It's nice to see some pretty awesome improvements on the enterprise side of Windows 8. I love all the virtualization support.

    I think they've finally reached a point where it's more beneficial to run apps in a "thin-client" style... virtualized OS image and Remote App setup... than to maintain multiple hardware and software configurations. :)
    GoodThings2Life
  • Windows 7 Recovery Disk/Flash drive for Ultrabooks?

    I'm having trouble getting my HP Folio 13 to properly recognize a recovery CD (created via an external USB CD/DVD drive). I've also tried creating a recovery flash drive but ran into some problems.

    Any tips, resources?
    rorrr
    • You're still under warranty

      I would recommend a call to HP support. My experience with them has been very good through the years. They can walk through a much more sophisticated and relevant troubleshooting protocol than I can.
      Ed Bott
      • Thanks. Tried it again. It worked.

        I simply erased the CD-RW and recreated a system repair disk. Surprisingly, it only took about 10 minutes to restore the image (~40GB).
        rorrr
  • I used VHDs

    I used VHDs for W8DP and W8CP installs.
    I had no problems with the VHDs (well ... I couldn't do an upgrade from DP to CP).

    W8 CP, on the other hand ... :(
    lehnerus2000
  • Dual Boot

    When installing another Windows OS on a Windows system as dual boot, one need not go through the process of restarting the machine, changing boot options, and wait minutes for installation to start. Just boot to your original OS, insert the boot media of 2nd OS, or just open the iso file (on a virtual drive or just extract the file to a folder), and double click the setup.exe file. Yes, you can install Windows just like any other application by double clicking the setup.exe file. You will save couple minutes booting from installation media.
    Raju Das
  • How can I do this?

    How can I do this if I don't have Windows Server 2008 R2
    Don't you need a server and the correct software to create a virtual harddrive?
    jughead4158@...
    • Say what?

      You don't need a server for any of this. The screenshots in this article were taken with Windows 7 Ultimate.
      Ed Bott
  • Thanks Ed

    Worked great. Nice that the VHD has access back to the original drive.
    compsrt