Hyper-V - Use Differencing Disks  

    Hyper-V - Use Differencing Disks

    Hyper-V - Use Differencing Disks

    How to Use Differencing Disks in Hyper-V
    Published by Category: Virtualization
    02 Sep 2019
    Designer Media Ltd



    information   Information
    A virtual machine using Differencing Disks is stored on two separate virtual hard disks. The Parent Disk contains the basic Windows installation, and the Child Disk all user settings, data, customizations and so on. Parent Disk can be write protected, and used as parent for multiple child disks.

    Quoting Microsoft Docs:

    A differencing disk is associated with another virtual hard disk that you select when you create the differencing disk. This means that the disk to which you want to associate the differencing disk must exist first. This virtual hard disk is called the “parent” disk and the differencing disk is the “child” disk.

    The parent disk can be any type of virtual hard disk. The differencing disk stores all changes that would otherwise be made to the parent disk if the differencing disk was not being used. The differencing disk provides an ongoing way to save changes without altering the parent disk. You can use the differencing disk to store changes indefinitely, as long as there is enough space on the physical disk where the differencing disk is stored. The differencing disk expands dynamically as data is written to it and can grow as large as the maximum size allocated for the parent disk when the parent disk was created.

    Especially when testing Windows Insider Preview builds in various editions and languages, I use differencing disks on Hyper-V virtual machines. This not only allows me to save storage space on my dedicated Hyper-V drive, but it also makes creating new virtual machines really fast, taking just seconds to boot to the desktop when a VM is run for the first time. No repeated clean installs are required.

    An added benefit is that when parent disk is stored on SSD, the child disks can be on HDD, yet being faster than if Windows was installed on a single VHD on HDD. This is especially convenient if your SSD is small. My SSD on this laptop is only 128 GB, I could not possibly store all virtual hard disks on it. Using parent disk on SSD and child disks on HDD, I get close to SSD speeds on my virtual machines. Notice that Hyper-V has no issues in using VHD files stored on an external hard disk; if you have a fast external USB3 HDD, that's a good place to store your child disks.

    In this tutorial you will learn how easy and convenient it is to use Differencing Disks in Hyper-V.




    Contents

     Use links below to go to any Part, back button of your browser to return to this list.



    Part One: Create Parent Disk
    Part Two: Create Child Disk
    Part Three: Create VM using Differensing Disks




    Part One

     Create Parent Disk


    1.1) Create a new virtual machine in Hyper-V (tutorial). Name it as you like. To fully benefit from using differencing disks, I want to create this VM on my C: drive (an SSD), instead of my dedicated Hyper-V drive on HDD.

    To select other than default location, select Store the virtual machine in a different location, and as location, enter the drive where you want it to be created:
    Hyper-V - Use Differencing Disks-select-vm-location.jpg

    Hyper-V now creates a folder on the drive you selected. Folder name will be the name you gave to VM.

    1.2) Only use Generation 2 virtual machines (UEFI with GPT partitioning), both when creating VM to prepare parent disk, and virtual machines to utilize child disks as we will do in Part Two.

    1.3) As always when creating a new VM, allocate it enough RAM, and disable dynamic memory. The VHD can be quite small, even 20 GB would be enough.

    However, virtual machines we will create later using child disk based on this parent disk will see the child VHD size as the same as parent VHD. If you now create a 20 GB dynamically expanding parent VHD, later child disks will also be 20 GB which leaves not much space to install software.

    My recommendation is to use Hyper-V default VHD size 127 GB when creating the parent VM and VHD.

    1.4) Start the VM, install Windows normally. After the first restart, OOBE starts and region selection screen is shown. Do not select any region, instead press SHIFT + F10 to open Command Prompt. Close Command Prompt immediately, we only needed to open it to activate WIN-key shortcuts and Windows Settings in OOBE.

    1.5) When Command Prompt was opened and closed, it changed the function of Ease of Access button bottom left. The button will now open Windows Settings app:
    Hyper-V - Use Differencing Disks-region-selection-shift-f10.jpg

    1.6) Click the button bottom left to open Settings. Run Windows Update, fully updating Windows:
    Hyper-V - Use Differencing Disks-open-settings.jpg
    Tip   Tip
    If the button for any reason does not open Settings, press WIN + R to open Run dialog, type following command and press Enter to open Settings:

    ms-settings:
    Hyper-V - Use Differencing Disks-settings.jpg

    1.7) OPTIONAL If you intend to use same parent disk on virtual machines in different languages, install language packs for each language you might need in the future. In my example case now, I installed Finnish (Suomi), Swedish (Svenska) and German (Deutsch) languages. Wait until all language packs have been installed:
    Hyper-V - Use Differencing Disks-additional-languages.jpg

    1.8) When Windows has been updated, and optional languages installed, close Settings. Press WIN + R to open Run dialog, type following command and press Enter to open Windows System Preparation Tool (Sysprep):

    %windir%\System32\Sysprep\Sysprep.exe
    Hyper-V - Use Differencing Disks-open-sysprep.jpg

    1.9) Sysprep dialog opens. Accept defaults, click OK to run Sysprep:
    Hyper-V - Use Differencing Disks-run-sysprep.jpg

    1.10) Windows will restart. Shut down VM when it returns to OOBE:

    Shut down if you installed additional languages

    If you installed additional languages (step 1.7), OOBE starts letting you to select in which language Windows should be setup. Click the VM Connection's Shut Ddown button:
    Hyper-V - Use Differencing Disks-shutdown-lang-screen.jpg

    Shut down when no additional languages:

    If you installed without adding additional languages, OOBE starts with Region Selection screen. Click the VM Connection's Shut Down button:
    Hyper-V - Use Differencing Disks-shutdown-region-screen.jpg

    1.11) You can now delete the VM used to create this parent disk in Hyper-V Manager, it will not be needed anymore.

    1.12) In File Explorer, browse to your Parent VHD folder. Delete both Snapshots and Virtual Machine folders, only leaving folder Virtual Hard Disks:
    Hyper-V - Use Differencing Disks-delete-folders.jpg

    1.13) Open Virtual Hard Disks folder, set the parent disk Read Only to protect it:
    Hyper-V - Use Differencing Disks-protect-parent-disk.jpg
    warning   Warning
    There's a simple reason we write protected the parent VHD and deleted the VM used in creating it. IF the parent VHD is changed in any way, even if the VM used to create it is used, booted once and immediately turned off, it can no longer be used as parent disk, and all child disks stop working, virtual machines showing an error message:
    Hyper-V - Use Differencing Disks-vhd-chain-broken.jpg

    To avoid this, it is extremely important that the VHD will never again be changed or used on a VM.

    Parent Disk is now ready to be used on future virtual machines with their respective child disks.



    Part Two

     Create Child Disk


    2.1) In Hyper.V Manager > Action pane, select New > Hard Disk:
    Hyper-V - Use Differencing Disks-new-vhd.jpg

    2.2) Select Differencing as disk type:
    Hyper-V - Use Differencing Disks-differencing.jpg

    2.3) I name the new child disk as Empty Child Disk, and store it to my default VHD folder:
    Hyper-V - Use Differencing Disks-empty-child-disk.jpg

    2.4) New Hard Disk Wizard is asking which parent disk I want to use. I browse to and select the parent disk I prepared in Part One:
    Hyper-V - Use Differencing Disks-parent-disk-location.jpg

    Done. Keep the empty child disk on safe place.

    Time to create first VM using differencing disks!



    Part Three

     Create VM using Differensing Disks


    3.1) Create a new Generation 2 VM. Name it as you wish, I prefer descriptive names. Select Store the virtual machine in a different location, and select a drive. Virtual machine folder will be created on root of that drive:
    Hyper-V - Use Differencing Disks-select-child-vm-location.jpg

    3.2) On Connect Virtual Hard Disk page, select Attach a virtual hard disk later:
    Hyper-V - Use Differencing Disks-attach-vhd-later.jpg

    3.3) When VM has been created, open File Explorer and copy the empty child disk you created in Part Two. Browse to folder in which you saved the new VM, and paste the VHD file. Rename it with a descriptive name:'
    Hyper-V - Use Differencing Disks-rename-child-vhd.jpg

    I always use the exact name of the VM, in this example case now I renamed the child disk as W10 PRO Insider x64 EN-GB.vhdx

    3.4) Before starting the VM first time, edit its Settings. Set RAM, processor count, Secure Boot and checkpoints as you'd prefer. Select SCSI Controller on left pane, select Hard Drive, click Add:
    Hyper-V - Use Differencing Disks-add-disk.jpg

    3.5) Browse to your VM's folder, select the empty child disk you copied there and renamed in step 3.3:
    Hyper-V - Use Differencing Disks-select-child-disk.jpg

    3.6) Last, the most important setting. You must change the boot order, making new VM boot from still empty child disk:
    Hyper-V - Use Differencing Disks-boot-vhd.jpg

    3.7) That was it. You can now run the VM, in less than a minute you'll land on OOBE Region Selection screen. Setup Windows as usual.

    3.8) When on desktop of the new VM, if you inspect the VHD in VM settings, you'll notice that the actual VHD file size, the space it occupies on your hard disk, is about 10 GB less than a normal Windows installation requires:
    Hyper-V - Use Differencing Disks-child-vhd-size.jpg

    This is because the Windows itself is installed on the parent disk, each subsequent VM only creates VHD files to store user profiles, settings and data, but there's no need to install Windows. Each virtual machine you create using a child disk of same parent disk saves you this 10 GB; using the same parent on five virtual machines, you've save about 40 GB storage space (10 GB * 5 - 10 GB on parent VHD).

    3.9) For a multilingual user, the beauty of differencing disks is in this: If you installed additional languages in step 1.7 on your parent disk, booting the new VM you can select the language before OOBE starts:
    Hyper-V - Use Differencing Disks-language-selection.jpg

    Selecting Swedish (Svenska) as in this example case, the Windows on my new VM, on its child disk, will be completely in Swedish:
    Hyper-V - Use Differencing Disks-swedish.jpg

    This although Windows installed on parent disk is British English.

    You are ready to go!

    I did a Differencing Disks presentation over a year ago, this image is from that presentation so pointers to version 1803 are already outdated. However, it is still a valid description about what Differencing Disks in Hyper-V means:
    Hyper-V - Use Differencing Disks-differencing-disks-powerpoint.jpg

    Let's keep virtualizing geeks!

    Kari


  1. Posts : 311
    Microsoft Windows 10 x64
       #1

    i have discovered differential disk with this tuto, thanks kari
      My Computer


  2. Posts : 13,690
    Windows10
       #2

    I studied how Viboot works, and it creates differencing disks from the Reflect image in a new VM.

    One minor problem is the VM is unactivated and you cannot do any new personalisation.

    However, you can temporarily attach the differencing disk to an activated VM (I am referring to Hyper-V) and make any new personalisation changes.

    Another minor issue with parent/child differencing disks is you cannot directly move them to another directory if you wanted to copy them.

    However, you can merge the parent and child vhds, copying the resultant vhd elsewhere. This is easy using the "edit disk - merge" function in Hyper-V.
      My Computer


 

Tutorial Categories

Hyper-V - Use Differencing Disks 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 20:22.
Find Us




Windows 10 Forums