Connect with us

Gadgets

How to Create a Hyper-V VM with a Differencing Disk

[ad_1]

Read this guide to learn how to create a child Hyper-V VM using a differencing disk that points to a parent disk.

Overview and Requirements

Creating a VM with a child disk pointing to a differencing disk is helpful in scenarios where you need to deploy VMs quickly without installing the OS on them manually.

However, to do this, the following requirements must be met:

  1. The child and parent virtual disks must be of the same format – that is, VHD or VHDX
  2. The parent disk must be syspreped, and the VM must shut down.

If the VM is joined to the domain, When you run Sysprep, it disjoins the VM from the domain.

Step 1: Prepare the Parent Virtual Disk

Step 1.1: Create a VM

Create a Generation 2 VM with a VHDX. If you need help doing this, read Create the Hyper-V Virtual Machines.

Step 1.2: Install OS, Patch, and Sysprep

After building the VM, install the OS, patch it, and install all apps you want to be in the parent virtual disk. Finally, run Sysprep with the Generarize, shutdown option.

Prepare the Parent Virtual Disk - sysprep generaralize
Prepare the Parent Virtual Disk - sysprep generaralize 2Prepare the Parent Virtual Disk - sysprep generaralize 2

When Sysprep is completed, and the VM shuts down, rename the virtual disk to something descriptive of its contents. Then, copy it to a location where you store virtual disks.

In my example, I renamed mine Veeam_Base and copied it to my lab’s VMM library share.

In my example, I renamed mine Veeam_Base and copied it to my lab's VMM library share. In my example, I renamed mine Veeam_Base and copied it to my lab's VMM library share.

Step 2: Create a Differencing Disk

You can create a differencing disks with the Hyper-V Manager but I like to use PowerShell as it is faster. Here is a sample command I used to create my differencing disk.

New-VHD -ParentPath G:SharesVMMLibraryVHDsVeeam_Base.vhdx -Path "C:ClusterStorageVolume1IPMvVeeamVirtual Hard DisksVeeam_VM_1.vhdx" -Differencing

Step 3: Create a VM with the Differencing Disk

I used the PowerShell command below to create a VM using the differencing disk. You may also use Hyper-V Manager.

New-VM -Name IPMvVeeam -MemoryStartupBytes 2GB -VHDPath "C:ClusterStorageVolume1IPMvVeeamVirtual Hard DisksVeeam_VM_1.vhdx" -Generation 2 -SwitchName Mgt-vSwitch -Path "C:ClusterStorageVolume1IPMvVeeamVirtual Machines"

See the screenshot below to demonstrate the benefit of creating a VM with a differencing disk.

The parent disk is 39GB, while the child disk is 626 MB!

Step 4: Complete the OS Installation on the VM

When you start the VM, it will load the OOB.

How to Create a Hyper-V Child VM with a Differencing DiskHow to Create a Hyper-V Child VM with a Differencing Disk

Complete the installation, rename the computer, assign a static IP and join the VM to the domain.

Conclusion

Creating VMs with a differencing disk provides a quick way to roll out VMs without reinstalling the Operating System and all apps.

In this guide, I explained the steps to complete this task, and I hope you found it helpful. Please respond to the question, “Was this page helpful?” to give feedback about this guide.

[ad_2]

Victor Ashiedu

Source link