Windows 10: Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD  

Page 1 of 2 12 LastLast
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD

    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD

    How to Create VHD of Windows 10 Installation and Use in Hyper-V
    Published by Category: Virtualization
    20 Mar 2017
    Designer Media Ltd

    Published by


    Kari's Avatar
    Finnish but not finished


    Location: A Finnish ex-pat in Germany
    Posts: 10,619

    Show Printable Version 


    How to Create VHD of Windows 10 Installation and Use in Hyper-V

    Note   Note
    The tutorial has been updated today (20-MAR-2017). Please post all your questions about this process in this thread.

    Please notice: some screenshots are from pre-release builds of Windows 10. Disk2VHD runs without any issues on and can create a VHD from any consumer and server version of Windows starting from Windows XP and Windows Server 2003.

    information   Information
    Disk2VHD is a practical free tool by Sysinternals, since 2006 a subsidiary of Microsoft Corporation. Sysinternals is well known of their wide range of free tools to manage, troubleshoot and diagnose Windows systems and applications. As the name already tells Disk2VHD is a tool to create a Virtual Hard Disk (VHD) file of an existing Windows system. This VHDfile can then be used to create a virtual machine in Windows Virtual PC (Windows 7) and Hyper-V (Windows 8 and later).

    In this tutorial we will download and install Disk2VHD on an existing Windows 10 computer, use it to create a VHD of the current Windows 10 installation on that computer and use the resulting VHD to create a virtual machine on Windows 10 Hyper-V. The virtual machine will be an exact copy of the original Windows installation apart of some hardware and drivers, Hyper-V replacing some hardware with its own virtual devices.

    The virtual machine will be fully functional and contain all software, user profiles and settings which were installed and present on the real physical computer and Windows when the VHD creation process was started.


    Contents:

    Part One: Install & Run Disk2VHD
    Part Two: Setup Hyper-V VM (MBR & GPT)
    Part Three: Prepare a Generation 2 GPT partitioned VHD
    Part Four: Run the new Windows vm

    Use links above to jump to any part of the tutorial. Click screenshots to pop out, click again to expand.



    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD Part One Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD
     Run Disk2VHD

    1.1)
    First, download and install Disk2VHD, a tool by Mark Russinovich at Windows Sysinternals:

    download

    1.2) Extract downloaded Disk2VHD.zip to a folder, run Disk2VHD application

    1.3) Name your VHD as you wish, select Save location (VHD file name), select both Use Vhdx (Hyper-V requires the file to be VHDX) and Use Volume Shadow Copy, select which drives to include in your VHD. Usually if you have done a default install and all your system files and folders are located on C: you only need to select it

    In addition to your Windows partition(s), remember to select the System Reserved partition (BIOS / MBR systems) or the Recovery Partition (UEFI / GPT systems), highlighted in below screenshots!

    BIOS / MBR:
    Name:  2016_06_13_11_09_091.png
Views: 10020
Size:  30.3 KB

    UEFI / GPT:
    Name:  2016_06_13_11_13_062.png
Views: 10023
Size:  41.8 KB

    Click Create to start creating the VHD to your selected location. Do not save VHD to any of the drives included in VHD being created!
    Note   Note
    About the Use Volume Shadow Copy selection:

    Disk2VHD allows you to create a VHD of a system which will be currently used and online. Selecting Use Volume Shadow Copy will cause Disk2VHD to create a Shadow Copy of your system as it was at the very moment you clicked Create. Creating the VHD might take quite a long time but as Disk2VHD reads the information it needs from the Shadow Copy, you can continue using your Windows as usual; any changes to the system like installed software or changes to desktop will not be included in VHD because they were done after the Shadow Copy was created.

    When you now click Create, you will notice that Disk2VHD does not start to write the VHD before it has finished creating the Shadow Copy (snapshotting included drives):
    Name:  2014-10-05_16h56_00.png
Views: 21458
Size:  32.2 KB


    1.4) This may take some time. Disk2VHD shows you an estimated time when it thinks the VHD will be ready, in my case this has usually been quite accurate. Creating the VHD now for this tutorial, the resulting just over 50 GB VHD took about 15 minutes to be created:
    Name:  2014-10-05_16h56_55.png
Views: 21226
Size:  20.9 KB

    1.5) Click Close when the VHD is ready




    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD Part Two Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD
     Setup Hyper-V

    2.1)
    If not already done, enable, setup and run Hyper-V as told in Hyper-V tutorial, Part Two and create an external virtual switch as told in the same tutorial, Part Three

    2.2) Create a new virtual machine in Hyper-V selecting Generation 1 (highlighted green in screenshot) in New Virtual Machine Wizard if your Disk2VHD is from a BIOS / MBR physical computer, and Generation 2 (highlighted yellow) if it is from a UEFI / GPT computer:
    Name:  image.png
Views: 359
Size:  215.0 KB

    If you are not sure which partitioning system the PC you made VHD from is using, right click the Start button on that computer and select Disk Management, then right click Disk 0 and select Properties. Now select the Volumes tab to see if your hard disk is GPT partitioned (#1 in screenshot) or MBR partitioned (#2):
    Click image for larger version. 

Name:	2016_06_13_10_56_191.png 
Views:	167 
Size:	127.3 KB 
ID:	84865

    2.3) In New Virtual Machine Wizard select Use an existing virtual hard disk, browse to and select the VHD you created with Disk2VHD, click Open:
    Click image for larger version. 

Name:	2014-10-05_17h10_15.png 
Views:	803 
Size:	142.1 KB 
ID:	6074

    2.4) Click Next:
    Name:  2014-10-05_17h11_50.png
Views: 2666
Size:  38.7 KB

    2.5) Click Finish:
    Name:  2014-10-05_17h12_31.png
Views: 2649
Size:  31.9 KB

    2.6) If you made a Generation 1 virtual machine, you are ready to go. Jump to Part Four below. If your new virtual machine is Generation 2 with a UEFI / GPT VHD, continue from Part Three





    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD Part Three Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD
     Prepare a Generation 2 GPT partitioned VHD

    3.1)
    Start the virtual machine. You will see it can't boot:
    Click image for larger version. 

Name:	image.png 
Views:	16 
Size:	116.7 KB 
ID:	125848

    3.2) Open VM settings. Change boot order making it boot from DVD (#1), add a Windows ISO image as DVD (#2), click OK to save settings:
    Name:  image.png
Views: 358
Size:  385.1 KB

    You can use any Windows 10 version and edition ISO, it does not have to be for the version and edition installed on your new Disk2VHD virtual hard disk

    3.3) Remember to disable Secure Boot; a Generation 2 VM cannot boot from DVD (ISO) when it is enabled:
    Name:  image.png
Views: 356
Size:  377.1 KB

    3.4) In Action menu select Reset to restart VM, boot it from DVD (ISO). Press SHIFT + 10 when you see Windows Setup prompt to open Command Prompt:
    Name:  image.png
Views: 360
Size:  140.4 KB

    3.5) Enter command diskpart to start Windows Disk Partitioning Utility (#1 in screenshot below), enter command list vol (#2) to get list of all partitions in your Disk2VHD virtual hard disk. You will see that Disk2VHD had deleted the EFI partition (#3, by default 99 MB) making it RAW. Without it Windows on GPT partitioned disk cannot boot:
    Name:  image.png
Views: 361
Size:  175.4 KB

    3.6) We need to format EFI partition. As we can see with list vol command (vol = volume), the EFI partition is volume 3. Select it with command sel vol 3 (#1 in next screenshot below), and format it with following command (#2):
    Code:
    format quick fs=fat32 label="System"

    Enter the FORMAT command exactly as told! Be sure that you have selected the correct volume, the RAW one. No confirmation is asked, if you have selected wrong volume you might accidentally nuke Windows!

    When done you can check again with list vol (#3) to see that the EFI partition is now correctly formatted in FAT32 file system (#4):
    Name:  image.png
Views: 359
Size:  193.4 KB

    3.7) Enter command exit to leave diskpart

    3.8) One thing missing, we have to create boot records. Before leaving diskpart I checked with list vol command to see which letter my 40 GB Windows partition on this VHD has (in diskpart drive letters are not always obvious ones). In my case now the Windows partition has letter C:

    I add boot records with command bcdboot C:\Windows:
    Name:  image.png
Views: 359
Size:  119.4 KB

    3.9) Open VM settings (File > Settings), change boot order to boot from EFI file:
    Name:  image.png
Views: 358
Size:  375.3 KB

    3.10) That's it. Close Command Prompt, click Close button in Windows Setup, click Yes to restart.
    Name:  image.png
Views: 357
Size:  178.2 KB




    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD Part Four Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD
     Run the new Windows vm

    4
    .1)
    Select your virtual machine on Hyper-V Manager, click Connect (#1) and wait until the vm windows has opened, then press Start (#2) to boot the vm:
    Click image for larger version. 

Name:	2014-10-05_20h21_46.png 
Views:	4113 
Size:	84.6 KB 
ID:	6100

    4.2) When your Windows 10 virtual machine has booted you will see your familiar lock screen and can sign in with any existing user profile:
    Click image for larger version. 

Name:	2014-10-05_17h15_48.png 
Views:	776 
Size:	1.35 MB 
ID:	6082

    4.3) When signed in you'll notice everything from your physical Windows 10 installation is there in your virtual machine, installed apps working:
    Click image for larger version. 

Name:	2014-10-05_17h37_04.png 
Views:	872 
Size:	1.22 MB 
ID:	6084


    That's it, now you can run your physical Windows 10 installation virtualized!

    Kari


  1. Kari's Avatar
    Posts : 10,619
    Windows 10 Pro
       25 Mar 2015 #1

    Just a heads up:

    The new build 10041 has none whatsoever issues in running Disk2VHD and creating a virtual hard disk of your existing Build 10041 installation. I just converted my laptop's Windows 10 Build 10041 to a VHD, created a new Hyper-V virtual machine using this VHD and everything is running smoothly and perfectly.

    Absolutely everything is there. I had language packs installed on laptop, user accounts created for private and work use plus for different languages to get Windows as I like, with one click language selection, the main profile folder Users relocated with Sysprep to drive E: and so on. All this was carried over to virtual machine:
    Click image for larger version. 

Name:	2015-03-25_14h48_09.png 
Views:	694 
Size:	153.7 KB 
ID:	15356
    All software I had installed on laptop work all settings intact on the virtual machine, even Steam and my games:
    Click image for larger version. 

Name:	2015-03-25_14h59_49.jpg 
Views:	615 
Size:	167.1 KB 
ID:	15357
    Nice!
      My System SpecsSystem Spec

  2. JDobbsy1987's Avatar
    Posts : 1,424
    Windows 10 Pro x64
       25 Mar 2015 #2

    Nice one Kari !
      My System SpecsSystem Spec

  3.    09 Jun 2016 #3

    When I start my Virtual Machine it remains in black whit "_"blinking. The state is running. I think the problem is when I create VHDX, I select use shadox copies and use VHDX, then y select C: , there i have my boot partition and all my data.
    What can i do?


    Trank you man
      My System SpecsSystem Spec

  4. Kari's Avatar
    Posts : 10,619
    Windows 10 Pro
       11 Jun 2016 #4

    Nuckete said: View Post
    When I start my Virtual Machine it remains in black whit "_"blinking. The state is running. I think the problem is when I create VHDX, I select use shadox copies and use VHDX, then y select C: , there i have my boot partition and all my data.
    What can i do?


    Trank you man
    I am sorry for a delayed response. There seem to be issues in creating a virtual hard disk file from a GPT partitioned (UEFI) source system, making the Hyper-V virtual machine made from GPT disks using Disk2VHD not bootable, not working.

    I think I have found a solution, easy and quite fast to do, but need to test it more before posting the instructions.

    I will post the instructions later after a few more tests, first tests already showing it works but I need to be sure.

    Kari
    Last edited by Kari; 11 Jun 2016 at 14:08.
      My System SpecsSystem Spec

  5.    12 Jun 2016 #5

    Thanks friend, I look forward to your response, I have tested for different operating systems like Windows 7, Windows 8.1 and Windows 10
      My System SpecsSystem Spec

  6. Kari's Avatar
    Posts : 10,619
    Windows 10 Pro
       13 Jun 2016 #6

    Note   Note
    The tutorial has been updated today (13-JUN-2016) and now also covers how to make a Hyper-V vm from a UEFI based, GPT partitioned host system with Disk2VHD.

    Part Three in tutorial is new, written today.

    Please post all your questions about this process in this thread.

    Kari
      My System SpecsSystem Spec

  7.    14 Jun 2016 #7

    Thank you, everything went well , it is possible to connect to a different network the virtual machine? For example connect my computer with ethernet and the virtual machine using Wi-Fi
      My System SpecsSystem Spec

  8. Kari's Avatar
    Posts : 10,619
    Windows 10 Pro
       14 Jun 2016 #8

    Nuckete said: View Post
    Thank you, everything went well , it is possible to connect to a different network the virtual machine? For example connect my computer with ethernet and the virtual machine using Wi-Fi
    You are welcome.

    Yes, it is possible to use different network adapter for Hyper-V virtual machines. In your case your host is connected through Ethernet, you just need to create another external virtual switch using your wireless adapter as told in the Hyper-V tutorial, browse to Part Three of it: Hyper-V virtualization - Setup and Use in Windows 10 - Windows 10 Forums

    Create a new external virtual switch and make your virtual machine use it in vm Settings > Network adapter.

    Kari
      My System SpecsSystem Spec

  9.    25 Nov 2016 #9

    Hey Kari, I'm wondering if you can help me. I get to step 3.8 and I get an error in AOMEI. Specifically Error 6. Here's a link to the error: Error Code 6

    I think System is locking the file so I can't actually perform the MBR conversion. I'm guessing it gets locked when I double click the file to open it in Explorer/Computer/Disk Management. Do you know how I might do the conversion without the file getting locked?
      My System SpecsSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
How to Create Shortcut of Hyper-V Virtual Machine in Windows 8 and 10 There's nothing wrong in running the Hyper-V Manager and launch your virtual machines from there. However, creating a shortcut for each vm you have you can start them fast...
How to Setup and Use Hyper-V in Windows 10 for OS Virtualization Windows 10 Pro, Education and Enterprise editions come with a built-in hypervisor client Hyper-V allowing users to create and run other operating systems on a virtual machine....
How to Create and Use Hyper-V Checkpoints in Windows 10 Checkpoint is a powerful Hyper-V feature to easily undo all changes on a virtual machine. You can play with virtual machines testing apps, changing settings, editing registry and so on as...
How to Install CentOS Linux on Hyper-V Virtual Machine in Windows 10 A working and quite nice alternative for dual booting is to install various operating systems on a virtual machine. CentOS is officially supported by Microsoft as a guest OS...
Solved Windows 10 and Hyper-V in Installation and Upgrade
I tried to install the preview as a virtual machine and everything went fine until after a reboot following the download and installation of the updates. Both 8.1 & 10 locked up with a strange crackling noise through the speakers every few seconds....
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 22:31.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums