Dual booting Windows 8.1 and Windows Server 2012 R2 from VHD

My main laptop doubles as a portable lab, with Windows 8.1 as my main work OS, dual booting with Windows Server 2012 R2 for lab testing purposes, training etc. The Server 2012 R2 install is a HyperV host as well as a domain controller. I boot Server 2012 from a VHD (VHDX to be precise), rather than installing it on a partition, because I want to be able to move this installation to another computer, for instance in order to upgrade my laptop or duplicate the setup on my desktop at home. All I need to do is copy the VHD file to another machine and I am up and running again.

My lapop setup is as follows:

– Lenovo X220 with 8GB of RAM, 250GB Samsung SSD

– 1 x 125GB partition, bitlockered default installation of Windows 8.1

– Second partition, no bitlocker, 111GB

If I was not using bitlocker, I would just have a single partition on the whole disk in in order to minimise space utilisation, but since you cannot boot a VHD from a bitlockered volume, I have to have a separate partition with no bitlocker. This is how the disks look in Windows 8.1 after partitioning:


Create the VHD file as follows:

  1. Open Disk Management
  2. Click the Action menu and then and select Create VHD
  3. I choose 20GB which is plenty when selecting dynamically expanding. I also choose VDHX since I am using Server 2012 R2 (VHDX are only supported in Windows 8.1 and Server 2012 R2 or later).

You could also do this in diskpart during the OS installation, but this is easier:



Now to install an OS to the VHD:

  1. Insert the Windows Server 2012 or 8.1 DVD or bootable USB key
  2. Press SHIFT-F10 to get to a command prompt
  3. Type in diskpart
  4. Select the vdisk you created: select vdisk file=D:\HyperV.vhdx
  5. Enter: attach vdisk
  6. Now exit and then just select the 20GB disk that you created

At this stage I get an error saying that Windows cannot be installed to the volume. However it lets me select the volume just the same and then starts installing and completes without any issues. Once done, you then have Server 2012 R2 installed to the VHDX file, which is on the separate volume. Since I use the machine as a HyperV host, this VHD file then has other VHD files inside it. So when I copy the VHD to another machine, it also copies over all the VMs hosted on that machine.

8 thoughts on “Dual booting Windows 8.1 and Windows Server 2012 R2 from VHD”

  1. Curious if you copy the VHD to another machine and have both running at the same time, will Microsoft detect this and disable one or both of them, temporarily or permanently?

    1. Hi, I don’t believe so, but this is not a good idea anyway to have 2 machines with the same SIDs. You should use sysprep if you are cloning machines.

  2. Hi Peter,I really like the ‘almost there’ pattern. It’d be great if you could expand of the subject. For example, pros and cons of this approach vs traditional error handling and whether it’s suited for every type of user interaction or just for specific ones. Also, is it an original idea of yours or has it been discussed prs?oiuelyvThanks in advance if you have the time/will to answer

  3. Yo Charlie!!How are you! Haven’t spoken to you in ages! Last time was daytime show & it was good!! Enjoyed our naughty coded chat! Keep doing them, but DEFN keep doing nighttime shows, a mixture is perfect.What time are you on tonight??? Can’t wait to see you in some sexy outfits. What you got in store? Nurse? College girl?Sam x

  4. How does someone go about choosing a college when you have a learning disability? Is it better to go to a community college or to a four year college or university? My friend who has a learning disability has been looking into both community college and four year college. He thinks that a four year college offers students alot more help than a community college?

  5. My programmer is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the expenses. But he’s tryiong none the less. I’ve been using Movable-type on a number of websites for about a year and am concerned about switching to another platform. I have heard great things about blogengine.net. Is there a way I can transfer all my wordpress content into it? Any kind of help would be really appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *