Second Generation of Virtual Machines in Windows Server 2012 R2

Today I would like to dwell in more detail on one of the new features of Hyper-V in Windows Server 2012 R2 , which I mentioned in a review post , namely, to discuss the second generation of virtual machines (VMs). The topic becomes especially relevant with the availability of RTM Windows Server 2012 R2 for TechNet and MSDN subscribers and the early release of the final version of System Center 2012 R2

Why did the second generation of VMs appear?

With the release of Windows Server 2012 R2 in Hyper-V, it became possible to create VMs of two different types or two different generations (Generation 1 and Generation 2). First-generation VMs are virtual machines well known from previous versions of Hyper-V. Everything that you are used to seeing in the VM settings, plus a number of new settings, you will see in the first generation machines. They have not disappeared, you can continue to use them calmly.

But beyond that, you can now create second-generation VMs. This generation reflects the changes that have occurred and continue to occur both in the architecture of the OS and in the hardware of modern computers. At the turn of Windows 2000, Windows XP, Windows Server 2003, operating systems were designed without taking into account virtualization technologies, then only gaining momentum. In order to normally launch such OSs inside a virtual machine, it was necessary to create for them the illusion of launching on a physical computer. As a result, it was necessary to emulate various equipment, such as: BIOS, interrupt controller, IDE controller, standard I / O ports, etc. You can easily see the list of emulated devices if you look at Device Manager on the first-generation VM.


Emulation, on the one hand, leads to additional overhead, first of all, to extra processor cycles, on the other hand, each emulated device is an additional rather complicated code, potentially expanding the surface for attacks.

Over time, the OS began to be designed taking into account the fact that the system can, or even most likely will work in a virtual environment. Such an OS “knows” what is launched inside the VM and, both at the boot stage and during its work, relies on resources provided by the parent partition (host OS). In other words, the OS already communicates with the hypervisor at the start via the VMBus bus, and does not expect to detect an interrupt controller or a certain type of chipset. Therefore, for such OSs, you can abandon inherited emulated devices and increase VM performance. Indeed, the picture will be different in the second-generation Deviсe Manager VM.


What are the benefits of second-generation VMs?

Refusal to emulate obsolete devices changes the “stuffing” of the second generation VM. In the properties of such VMs you will see something like the following:
From here, the following advantages of the second generation VMs can be distinguished:
  1. Safe boot (Secure Boot) VM . Instead of the standard BIOS, firmware is used based on the UEFI specification and, as part of this specification, safe boot of the VM is supported, which prevents the possibility of the OS hitting at startup. Secure Boot may be disabled.
  2. Booting from a virtual SCSI disk or SCSI-DVD . A virtual IDE controller is generally absent in second-generation machines.
  3. "Hot" resizing the boot partition . “Hot” addition, as well as resizing (including reduction) of virtual SCSI disks, is also possible for first-generation VMs. But since it is the second generation VMs that can boot from SCSI, then for them you can resize including the boot partition "on the fly".
  4. Network booting using a synthetic network adapter is faster than using the Legacy Network Adapter in a first-generation VM.

The table below summarizes the “hardware” changes in the second-generation VM.
Legacy Devices Removed Replacement devices Enhancements
IDE Controller Virtual SCSI Controller Boot from VHDx (64TB max size, online resize)
IDE CD-ROM Virtual SCSI CD-ROM Hot add / remove
Legacy BIOS UEFI firmware Secure boot
Legacy NIC Synthetic NIC Network boot with IPv4 & IPv6
Floppy & DMA Controller No floppy support
UART (COM Ports) Optional UART for debugging Faster and more reliable
i8042 keyboard controller Software based input No emulation - reduced resources
PS / 2 keyboard Software based keyboard No emulation - reduced resources
PS / 2 mouse Software based mouse No emulation - reduced resources
S3 video Software based video No emulation - reduced resources
PCI bus VMBus
Programmable Interrupt Controller (PIC) No longer required
Programmable Interrupt Timer (PIT) No longer required
Super I / O device No longer required

A reasonable question arises: is the speed of the first and second generation VMs different? When the OS boots, you most likely will not notice any difference in the speed of work. Integration components inside the guest OS allow VMs to work as efficiently as possible. But there are two situations in which the difference can be very noticeable - this is installing the guest OS and loading the VM. It is at these stages that equipment emulation is very significant.

As an illustration, I conducted the following experiment: I created two VMs, the first and second generation, respectively, allocated the same amount of RAM and virtual processors to both VMs and simultaneously launched the installation of Windows Server 2012 R2 inside the created VMs from the same ISO image. This is what the picture looked like in the initial installation phase (second-generation VMs below):
And such a difference could be observed later:
Thus, when deploying a VM, and also when starting a VM, which, for example, is especially important in VDI scenarios, the difference in performance Second-generation VMs can reach 50% or more.

Features of using second-generation VMs

It is necessary to remember several fundamental points relating to the operation of second-generation VMs.

Only the following can be used as guest OSs in second-generation VMs:
  • Windows Server 2012
  • Windows Server 2012 R2
  • 64-bit version of Windows 8
  • 64-bit version of Windows 8.1

This is due to the fact that these OS versions support the UEFI 2.3.1 specification, in which, in particular, Secure Boot technology is implemented.

You can create a virtual machine of the second generation in the Hyper-V console,
or by using the PowerShell cmdlet to the New-the VM , specifying the key -Generation 2 .

It should be borne in mind that the generation is indicated only at the stage of creating a VM. In the future, it is impossible to convert VMs from one generation to another just because the BIOS is used in one case and UEFI in the other.

The last aspect that I would like to note is related to management. Host management with Windows Server 2012 R2 is possible using System Center 2012 R2 Virtual Machine Manager. The now available preview version of System Center 2012 R2 does not support second-generation VMs. But in the RTM version of System Center 2012 R2 (and it is just around the corner) this support will be added.

So, the new generation of VMs in Windows Server 2012 R2 is deprived of obsolete emulated devices, supports a number of new features and provides a performance boost, especially during the installation and boot stages of guest OSs. The use of second-generation machines now narrows the list of supported guest OSs, however, for other systems, you can still use first-generation VMs that coexist perfectly with second-generation VMs on the same virtualization host.

You can find more information about the new technologies in Windows Server 2012 R2 on the MVA portal in the Jump Start: All About Windows Server 2012 R2 course .

Hope the material was helpful!