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

Page 1 of 3 123 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
    23 Jan 2019
    Designer Media Ltd

    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 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.



    Part One

     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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2016_06_13_11_09_091.png

    UEFI / GPT:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2016_06_13_11_13_062.png

    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):
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_16h56_00.png


    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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_16h56_55.png

    1.5) Click Close when the VHD is ready




    Part Two

     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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    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):
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2016_06_13_10_56_191.png

    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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_17h10_15.png

    2.4) Click Next:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_17h11_50.png

    2.5) Click Finish:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_17h12_31.png

    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





    Part Three

     Prepare a GPT partitioned VHD


    3.1)
    If you start the virtual machine now, you will see it can't boot:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    Shut down the VM.

    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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    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) Disable Secure Boot:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    3.4) Start VM, boot it from DVD (ISO). Press SHIFT + 10 when you see Windows Setup prompt to open Command Prompt:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    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):
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    3.9) Open VM settings (File > Settings), change boot order to boot from EFI file:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png

    3.10) That's it. Close Command Prompt, click Close button in Windows Setup, click Yes to restart.
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-image.png




    Part Four

     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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_20h21_46.png

    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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_17h15_48.png

    4.3) When signed in you'll notice everything from your physical Windows 10 installation is there in your virtual machine, installed apps working:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2014-10-05_17h37_04.png


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

    Kari






  1. Posts : 17,661
    Windows 10 Pro
       #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:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2015-03-25_14h48_09.png
    All software I had installed on laptop work all settings intact on the virtual machine, even Steam and my games:
    Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD-2015-03-25_14h59_49.jpg
    Nice!
      My Computer


  2. Posts : 1,416
    Windows 10 Pro x64
       #2

    Nice one Kari !
      My Computer


  3. Posts : 6
    Windows 10
       #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 Computer


  4. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #4

    Nuckete said:
    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 Computer


  5. Posts : 6
    Windows 10
       #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 Computer


  6. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #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 Computer


  7. Posts : 6
    Windows 10
       #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 Computer


  8. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #8

    Nuckete said:
    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 Computer


  9. Posts : 1
    Windows 10
       #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 Computer


 

Tutorial Categories

Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
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 01:09.
Find Us




Windows 10 Forums