Dual booting Windows 8.1 and Windows Server 2012 R2 from VHD

Windows Server Blue logo

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.

Posted in Server

Related Posts


  1. Snore Horse-Hemingway

    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?

    • Bob

      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. Pingback:Install Windows to VDHX virtual hard disk on a new hard drive - Cloudrun

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: