How to: Using Differencing Disk and Sysprep Image to create Hyper-V guest on Windows Server 2008 R2

When you have to create an testlab environment with multiple servers, it is a big job to install all the servers. Even when you are using Hyper-V in this environment. You manually have to install all the servers or make clones of another virtual machine. In this scenario it is very usefull to make use of Differencing Disks within Hyper-V. A Differencing Disks are linked to an master VHD file. This master VHD file is a virtual machine that has been sysprepped.

Basically, all of the main reads for the VMs created with a differencing disk come from the master VHD, while any changes (writes) are written to the differencing disk. The differencing disk will remain fairly small, because the amount of change should be minimal. You’re probably looking at around a couple of GBs per differencing disk. With a differencing disk you can build multiple machines with the same parent sysprep image.

You can build this environment by following the next steps;

1.) Create a new virtual machine within Hyper-V
2.) Install the Operating System with the specific updates
3.) Optionally you can install some base applications
4.) Sysprep the virtual machine. You can use the following command:
%windir%\system32\sysprep\sysprep.exe /generalize /shutdown
5.) Now the virtual machine is sysprepped and power off
6.) Create a new virtual machine (or multiple)
7.) Create a new VHD using differencing disk
8.) Navigate to the base VHD file you’ve just created (the sysprepped virtual machine)
9.) Edit some other settings within the virtual machine (cores, memory, NIC, etc.)
10.) Boot the new virtual machine
11.) Walk through the “First Run” steps of the Operating System
12.) The new virtual machine is now ready to use
13.) Navigate to the differencing disk (VHD) and see how big it is…right it’s really small! 🙂

Tags: , ,

Comments are closed.