Windows 10: Hyper-V - Use Differencing Disks

Discus and support Hyper-V - Use Differencing Disks in Windows 10 Tutorials to solve the problem; How to: Hyper-V - Use Differencing Disks [img] Information A virtual machine using Differencing Disks is stored on two separate virtual hard disks.... Discussion in 'Windows 10 Tutorials' started by Brink, Jul 17, 2018.

  1. Brink Win User

    Hyper-V - Use Differencing Disks


    How to: Hyper-V - Use Differencing Disks

    Hyper-V - Use Differencing Disks [​IMG]
    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:

    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 [/i] Use links below to go to any Part, back button of your browser to return to this list.


    [table][tr][td]Part One:[/td] [td]Create Parent Disk[/td] [/tr] [tr][td]Part Two:[/td] [td]Create Child Disk[/td] [/tr] [tr][td]Part Three:[/td] [td]Create VM using Differensing Disks[/td] [/tr] [/table]




    Part One [/i] 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 [​IMG]


    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 [​IMG]


    1.6) Click the button bottom left to open Settings. Run Windows Update, fully updating Windows:

    Hyper-V - Use Differencing Disks [​IMG]


    Hyper-V - Use Differencing Disks [​IMG]
    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 [​IMG]

    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 [​IMG]


    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 [​IMG]


    1.9) Sysprep dialog opens. Accept defaults, click OK to run Sysprep:

    Hyper-V - Use Differencing Disks [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]


    1.13) Open Virtual Hard Disks folder, set the parent disk Read Only to protect it:

    Hyper-V - Use Differencing Disks [​IMG]


    Hyper-V - Use Differencing Disks [​IMG]
    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 [​IMG]


    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 [/i] Create Child Disk
    2.1) In Hyper.V Manager > Action pane, select New > Hard Disk:

    Hyper-V - Use Differencing Disks [​IMG]


    2.2) Select Differencing as disk type:

    Hyper-V - Use Differencing Disks [​IMG]


    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 [​IMG]


    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 [​IMG]


    Done. Keep the empty child disk on safe place.

    Time to create first VM using differencing disks!


    Part Three [/i] 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 [​IMG]


    3.2) On Connect Virtual Hard Disk page, select Attach a virtual hard disk later:

    Hyper-V - Use Differencing Disks [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]


    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 [​IMG]

    Let's keep virtualizing geeks!

    Kari

    :)
     
    Brink, Jul 17, 2018
    #1
  2. Kari Win User

    Video: Hyper-V Differencing Disks

    Last Saturday, 8th of December, we had one of our TenForums Live webcasts. The topic was Hyper-V, and I had prepared a presentation / demonstration about how to use Differencing Disks to save both storage space and time.

    Although the webcast was recorded, it was too hard to edit the footage because lots of on & off topic chat going on, questions and answers and so on. I decided to make a "clean" capture instead of posting that video.

    You geeks who participated, please do not take this wrong; it is completely OK to chat and interrupt presentations with clarifying questions. I just thought that the topic is important, and wanted to make a bit better video.

    jKFQuBv9kbM

    Video description on YouTube:

    Originally posted in TenForums Video thread.
     
  3. cereberus Win User
    Differencing Hard Disk - Hyper-V

    I came across this option when creating a new had drive in Hyper-V.

    Has anybody ever used one - is it analogous to e.g. a checkpoint, or an incremental image backup in Macrium Reflect?

    When and how would you use it?


    Hyper-V - Use Differencing Disks [​IMG]


    Edit - been reading up on it and they look quite cool for a test environment.

    It is rather like a Macrium Differential image ie it contains all the changes from base version.

    So you could have a base install, do a cumulative update in a differencing drive, test it, and if ok, merge the results (to original or new drive).

    If you decide to discard the differencing drive you simply delete it and set the base drive as the drive in hyper-v.

    Of course, you cannot modify the base drive and keep a differencing drive based on earlier version of base image.

    One cool thing I see is ability to have a base image, then sysprep to a differencing drive, and then merge the base and differencing drive to a new drive.

    One weakness dynamics vhds have is they grow as you do updates, but even if you delete stuff using disk cleanup, you cannot physically recover the space even if you use powershell shrink commands.

    The usual solution is to copy partitions to a new vhd using tools like Minitool Partition Wizard or Macrium Reflect adjusting sizes to recover space.

    I am hoping that if you merge a base and differencing drive to a new one, space is optimally recovered. My project this week :-D
     
    cereberus, Oct 27, 2019
    #3
  4. cereberus Win User

    Hyper-V - Use Differencing Disks

    Differencing Hard Disk - Hyper-V

    I followed later part of this guide which says mount differencing drive and use bcdboot to add a boot entry but it would not let me mount it as a drive saying it was in use.

    Windows 8 Boot to Differencing VHD


    PS - as we know, it is a good idea to create base vhd in Hyper-V first so it has the hidden efi partition as well so vhd can be used on hyper-V as well.
     
    cereberus, Oct 27, 2019
    #4
  5. cereberus Win User
    Differencing Hard Disk - Hyper-V

    Thanks Kari, as you say I got the gist of it. One thing is evident (and articles said this) is that you do need to do it really on an ssd as hdds are not really fast enough.

    May I suggest that this might make an interesting topic at the next TF Live session?

    If I understand the articles I read, you can do similar with vhds mounted on host but you have to use powershell commands rather than the Hyper-V gui to create differencing drives etc.

    I like the idea of this as I sometimes use dism to install Insider versions to a dual boot vhd, and it would be nice to use differencing drives there as well. It is a pity you cannot upgrade W10 builds in a vhd on a host pc (easy enough to use Hyper-V).
     
    cereberus, Oct 27, 2019
    #5
  6. cereberus Win User
    Differencing Hard Disk - Hyper-V

    Compacting had little benefit but never mind.

    More importantly, I managed to mount my differencing drive using attach from disk management (for some reason FE mount will it work on my pc), created a boot entry and after a bit of faffing with drivers (specific to my laptop amd sata controller), and I sucessfully booted into the differencing drive on host - hip hip hooray!

    The possibilities are endless now. It is just a shame you cannot upgrade VHDs on host and have to go by Hyper-V.
     
    cereberus, Oct 27, 2019
    #6
Thema:

Hyper-V - Use Differencing Disks

Loading...
  1. Hyper-V - Use Differencing Disks - Similar Threads - Hyper Differencing Disks

  2. How to boot into bootable differencing vhdx in Hyper-V

    in Windows 10 Virtualization
    How to boot into bootable differencing vhdx in Hyper-V: Hello, I am trying to upgrade my boot to VHD VHDX to the latest Windows 10 update using this terrific tutorial from @Kari: Native boot Virtual Hard Disk - How to upgrade Windows However, I am having trouble getting the vhdx to boot in Hyper-V. Everything seems to work as...
  3. Video: Hyper-V Differencing Disks

    in Windows 10 Virtualization
    Video: Hyper-V Differencing Disks: Last Saturday, 8th of December, we had one of our TenForums Live webcasts. The topic was Hyper-V, and I had prepared a presentation / demonstration about how to use Differencing Disks to save both storage space and time. Although the webcast was recorded, it was too hard to...
  4. Differencing Hard Disk - Hyper-V

    in Windows 10 Virtualization
    Differencing Hard Disk - Hyper-V: I came across this option when creating a new had drive in Hyper-V. Has anybody ever used one - is it analogous to e.g. a checkpoint, or an incremental image backup in Macrium Reflect? When and how would you use it? [img] Edit - been reading up on it and they look quite...
  5. Hyper-V

    in Windows 10 Gaming
    Hyper-V: Hi, As anyone tried Hyper-V yet, as isn't it suppose to be an emulator so we can play old games like Silver etc... 6618
  6. Slow writing to physical disks in Hyper-V

    in Windows 10 Virtualization
    Slow writing to physical disks in Hyper-V: If I copy a file from C drive in a hyper-v install to a separate partition on the vhd, I get approx 100MB/s which is pretty much the maximum hdd speed that contains the vhd. However, when I copy a file to an external physical drive, it is very slow @ approx 5 MB/s. Any...
  7. HYPER-V Non persistent Disks ???

    in Windows 10 Virtualization
    HYPER-V Non persistent Disks ???: Hi folks particularly @Kari With HYPER V is it possible to create a training environment so that people can do exercises / tutorials on a VM but at the end of the session the Virtual HDD's are restored to the initial state. With VMWARE it's easy enough but I'm not sure...
  8. Virtual Hard disk created in hyper-v

    in Windows 10 Virtualization
    Virtual Hard disk created in hyper-v: Hi There I am using windows 10 Pro, and had a virtual machine installed using Hyper-V with two virtual HDD in that VM. Recently I had some problem with my Windows 10 OS and had to reset my windows with keeping all the files and settings, and it installed a new windows...
  9. Nested Hyper-V using AMD Chipsets?

    in Windows 10 Virtualization
    Nested Hyper-V using AMD Chipsets?: Anybody heard rumors about when MS might work with AMD to provide nested Hyper-V capability? They provide now only with Intel. 45553
  10. Installing Ubuntu in VM using hyper-v

    in Windows 10 Virtualization
    Installing Ubuntu in VM using hyper-v: Apologies for the very basic question, but this is my first attempt at creating a virtual machine within Windows 10 pro using hyper-v. I have created a VM, and during the process allocated a drive/folder for that VM, and selected the Linux iso file that should be installed....