Go to ...

RSS Feed

Hyper-V and Differencing Disks


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.

Quoting Microsoft TechNet:

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.

A typical scenario would be for instance to install Windows 10 version 1803 on a new virtual machine and use its virtual hard disk file (VHD or VHDX) as parent to three differencing child disks. Now create three new virtual machines, assigning one of the child disks to each new VM. Keep one VM in official version 1803 release, opt in for Insider builds on two others and upgrade one to Fast Ring and another to Skip ahead builds.

Click to open enlarged in a new tab.

This simple and fast procedure already saves about 20 GB of storage space on a hard disk. If all three virtual machines were using normal virtual hard disks, they would each be between 10 and 12 GB, whereas now the parent disk is about 10 GB and all child disks about 2 GB, a grand total of 16 GB. Of course all child disks will grow later when software is installed and they are updated and upgraded, but they will forever remain about 10 GB smaller than the same Windows 10 virtual machine with the same software installed on a normal VHD.

For me, using differencing disks is a real time and space saver. At any given time, I will have at least four but often up to eight Windows Insider virtual machines for each edition I am testing (Pro, Education, Enterprise). I want to test both Fast Ring and Skip Ahead builds in both my native languages Finnish and Swedish, the language of my adopted home country Germany, and of course in English (UK English in my case). In this post I will show how to do that, hoping it might benefit other multilingual users.

First, I clean install the latest UK English Fast Ring build on a new virtual machine named ParentVHD, storing it on my system SSD. I run the VM, boot it to Audit Mode and customize it by applying my theme files, changing how File Explorer is shown and other such minor stuff. When done, I generalize WIndows with Sysprep, restarting to OOBE. In OOBE region selection screen, I use SHIFT +F10 to open the Command Prompt which activates WIN-key shortcuts. Now WIN + R opens the Run prompt where I can type ms-settings: (colon after the command is not a typo!) and hit Enter to open the Settings app to install Finnish (Suomi), Swedish (Svenska) and German (Deutsch) language packs:

Click to open enlarged in a new tab.

Now I Sysprep once again, this time without the /generalize switch, shutting down the VM. The VM used to create a parent disk can be later deleted, the only important thing in it being its VHDX file which I will use as the parent disk when creating child disks. To assure I will not mess with the parent disk in the future, I mark it Read Only in its file properties. It’s important to remember that the VHD used as parent disk cannot be modified in any way to assure functionality of its child disks. If you for instance do not delete the VM you used to create parent disk and do not write protect the VHD, and run the VM even once which alters the size of VHD with a few KB, it voids your child disks. They will only work as long as their parent disk is not altered in any way.

About the above, see this post for how to get Fast and Skip Ahead ISO images for clean install, and this post for how to boot to Audit Mode, Sysprep and generalize Windows image.

In the New Virtual Machine Wizard, you cannot select differencing disk. Therefore I will first create four child disks in Hyper-V Manager > New > Virtual Hard Disk selecting Differencing disk:

Click to open enlarged in a new tab.

I name these four child disks as W10 IP x64 LANGUAGE.vhdx, replacing LANGUAGE with English, Swedish, Finnish and German respectively. When New Virtual Hard Disk Wizard asks about the parent, I point it to VHDX of the VM i created at beginning of this process:

Click to open enlarged in a new tab.

As the parent disk is on an SSD, I can save these child disks on my Hyper-V drive on a storage HDD. Because the Windows base (parent disk) is run from SSD, it makes children fast enough even when on HDD. Because the parent disk is write protected, and all later saves go to child disks on HDD, there’s also minimal “wear and tear” on SSD.

Now it’s a fast and easy job to create four new virtual machines, each using one of the newly created child disks. I name these four VMs as W10 IP x64 LANGUAGE, where LANGUAGE is one of the four languages mentioned earlier.

Running each of these four virtual machines, they will boot to OOBE in seconds, showing this:

Click to open enlarged in a new tab.

Before continuing, here's a short off topic rant: You Microsoft localization geeks, although languages are written with a lower case first letter in mid-sentence in both Finnish (suomi) and Swedish (svenska), this screen would be visually more pleasing if they were written using upper case first letter!

OK, now selecting for instance Swedish (svenska), this VM using a child disk would be fully set up in Swedish. The change is immediate, so the rest of OOBE is shown completely in Swedish, Windows now switched completely over to Swedish:

Click to open enlarged in a new tab.

Click to open enlarged in a new tab.

 

That’s it! I have now four Insider Preview Fast Ring virtual machines, each in one of the four Windows languages I use. The parent, a write-protected virtual hard disk is 10 GB in size, including all installed language packs and my customizations before syprepping it. Each of my four child disks are about 2 GB, plus or minus a few MB depending on the language. All in all, these four virtual machines use a grand total of 18 GB of storage space, four times child (2 GB each), plus 10 GB for the parent disk. Compare that to the 46 to 48 GB of storage space these four virtual machines would require if all were using normal virtual hard disks. With a size reduction of 28-30 GB, that’s quite a lot!

Now I repeat this process for Skip Ahead builds, again saving a lot of space. Talking about just one edition, Pro for example, having both Fast Ring and Skip Ahead virtual machines using differencing disks, I have saved almost 60 GB worth of storage space. Not to mention the time savings, either: I only had to install both Fast and Skippy versions once.

Don’t hesitate to post your questions in Comments.

Kari

Author: Kari Finn

A Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

Leave a Reply