Creating your Hyper V Windows Server 2012 machine from a differencing disk


Differencing disks are a way to save space, but still deploy the same amount of virtual machines. This solution allows you to create one parent image with a base Windows installation (including common patches/updates and software) and then set up all other VM’s based on that one parent image. So, you’d create one parent image, 30GB in size, with Windows Server 2012 plus all the latest updates, and then create child images for each other VM, only the changes between the parent and child are stored in the child disk.

As you can see above, there is a Windows Server 2012 virtual disk of 30GB. By using it as a differential disk, I can create 4 virtual machines (SharePoint 2012, Azure, Office WebApps, MetaStorm Server) which once booted will already have Windows Server 2012 on it, they then get the relevant software installed for that server. The child disks will grow with the difference between parent and child. If you built each machine from scratch without a differencing disk they would take up over 156GB of hard drive space. By using differencing disks you only use up 66GB of space.  Create your base Windows 2012 vhdx file, and get it to a state that has all that you need on all machines, and then sysprep it. This puts it in a state ready to be activated for the first time. This will allow you to re-use this Virtual Disk multiple times for multiple Hyper V machines if you set up the Hyper V machine with a differencing disk, as shown in the diagram above. Steps to create your first differencing using Windows 2012.vhdx as your parent disk.

  1. Open up Hyper-V manager, in the actions panel (top right) click New -> Hard Disk. On the Wizard click Next.
  2. Choose the disk format as VHDX. Click Next.
  3. Select Differencing. Click Next.
  4. Specify the Name for your child virtual disk. So in my example SharePoint2013. Set the location on a different physical drive. This will give better performance. E.g. D:\Virtual Machines\HardDisk\SharePoint2013\. Click Next.
  5. Specify the location of the parent disk. E.g. C:\virtual Machines\Hard Disk\Windows 2012.vhdx. Click Next
  6. Click Finish.

Steps to create your virtual machine using your differencing disk.

  1. Open up Hyper-V manager, in the actions panel (top right) click New -> Virtual Machine. On the Wizard click Next.
  2. Name your virtual machine (e.g Sharepoint 2013). Tick “Store the virtual machine in a different location”. Set the location as for example d:\Virtual Machines\. Click Next.
  3. Set your start up memory. My Sharepoint machine will use 10GB of memory therefore I’ll type in 10240. Do not use Dynamic Memory for SharePoint I have been informed.
  4. (Assuming you have followed this blog and done steps 2 and 3 from sub heading Creating a new Hyper V machine from your VHD files) Configure networking to use the connection External Switch. Click Next
  5. Select Use an existing virtual hard disk, then select the child hard disk, for example d:\virtual machines\Hard disk\SharePoint2013\SharePoint2013.vhdx. Click Next.
  6. Click Finish.

     You can now start your virtual machine.

Advertisements