21/10/2014 Leave a comment
Since the first Microsoft virtualization software called Virtual PC, followed by Virtual Server and then Hyper-V, the virtual machine used by them has been almost the same, with some improvements and features here and there, but keeping the old virtualized hardware, an Intel 440BX chipset.
Windows Server 2012 R2 introduces Generation 2 Virtual Machines with new features and possibilities that were not available in the previous generation.
This new type of virtual machine changes the way we create, configure and manage our virtual servers in Hyper-V. Some of these features include the replacement of BIOS with UEFI, boot from SCSIs, removal of legacy drivers, secure boot and so on.
With new architecture and removal of some legacy features, Generation 2 VMs also have some limitations that can restrict its usage in production so before starting using these new VMs, it is important to understand the differences and limitations of each generation.
In this article you will see how to create, configure and verify Generation 2 Virtual Machines.
Generation 2 Virtual Machines are available right after the Hyper-V installation so you just need your Hyper-V Server installed and ready to create new VMs.
How to do it…
The next steps will guide you through how to create, check and configure Generation 2 Virtual Machines.
1. To create a new Generation 2 Virtual Machine, open Hyper-V Manager, under the Action pane click on New and select Virtual Machine.
2. In the New Virtual Machine Wizard, click Next.
3. In Specify Name and Location, type the virtual machine name, location and click Next.
4. In Specify Generation, select Generation 2, as shown in the next screenshot, and click Next.
5. In Assign Memory, specify the Startup memory and if you want to enable Dynamic Memory, click on Use Dynamic Memory for this virtual machine and click Next
6. In Configure Networking, select the network connection in the dropdown list and click Next.
7. In Connect Virtual hard Disk, specify the Name, Location and Size of your new hard disk. You can also use an existing virtual hard disk or skip this option to attach a virtual hard disk later.
8. In Installation Options, select the preferable installation option, click Next and then Finish.
Note: You can also create a new Generation two virtual machine using the command New-VM -VMName VM02 -Generation 2. If the generation option is not specified, Hyper-V will create a Generation 1 VM by default.
9. To verify all virtual machines and their generation version, type the following PowerShell command:
Get-VM | fl Name,Generation
10. To check the virtual machine Generation using the graphical interface, select the virtual machine in Hyper-V Manager and click on the Summary tab in the bottom of the console, as shown in the next screenshot.
11. To set the new Firmware feature options in a Generation 2 Virtual Machine, right click on the VM and select Settings.
12. In the Settings window, click on Firmware, as shown in the following screenshot.
13. By default, Secure Book is already enabled. To disable it, unmark the check box Enable Secure Boot.
Note: Microsoft recommends Secure Boot to be enabled whenever possible. It should be disabled only when a secure book scenario is not supported.
14. To change the book order, select the device under Boot order and click Move Up or Move Down to get the desired order.
15. To add a device on top of the boot order list using PowerShell, type the following command.
$vm = get-vm "VMName"
$dvd = Get-VMDvdDrive $vm
Set-VMFirmware $vm -FirstBootDevice $dvd
16. By default, Generation 2 VMs do not have DVD drivers. To add a new driver, click on SCSI Controller, select DVD Drive and click Add. The next screenshot shows a new DVD Drive added. To change the Controller and Locations, use the menus under DVD Drive. To select a DVD image, click on Image file and specify the image location.
17. When finished, click OK and your Generation 2 VM will be ready for use.
How it works…
Generation 2 Virtual Machines were introduced in Windows Server 2012 with massive changes in their structure since the Hyper-V first release. There were VM improvements and features added in previous versions before but this is the first time that the whole virtual machine was changed.
As the previous generation had some limitations, the idea of this new model is to provide new features and prepare new improvements for future releases. To make it possible, some features were removed and as result, there are some limitations.
One of the most interesting feature that opened great functionalities was the replacement of the old BIOS system to a new boot system using UEFI firmware, which uses a high-level language that is easy to be extended. Some features that were possible with UEFI are Secure Boot, larger boot volumes, GPT boot disks and better performance during the boot. Because these systems are very different and have different capabilities, is impossible to convert virtual machines between generations.
Another change was the removal of old legacy drivers like legacy network adapter, IDE controller, floppy controller, COM Ports and DMA controller. This bring a cleaner virtual machine configuration with less devices and a much better boot performance. DVD Devices are still available, but are not added by default. They can only be added through SCSI Controllers, which supports nows up to 256 DVD drivers per VM. It’s also important to mention that passthrough DVD hardware devices cannot be added in Generation 2 VMs, that means only DVD image files such as ISO can be used.
As example of these benefits, the next image shows the device manager console of a Generation 1 virtual machine on the left and the new generation on the right.
Another good example of how easy a Generation 2 VM is to be managed and maintained is the VM settings window. The following screenshot shows a Generation 1 VM on the left side and the new generation on the left.
On the other hand, Generation 2 VMs can be a problem for certain scenarios, given it only support specific Operating System versions and has no legacy devices.
To help you decide which version can be used in your environment, the following lists explain the benefits and limitations of Generation 2 VMs:
Benefits and Features:
- · Replacement of BIOS with the new UEFI firmware
- · Secure Boot
- · More performance during boot process
- · Boot Volume can have up to 64GB
- · Boot disk can be configured as MBR or GPT disks
- · DVD Drives attached to SCSI controllers supporting up to 256 DVD drivers per VM
- · No more legacy devices such as Legacy Network Adapters, IDE Controller, Floppy Controller and COM ports
- · Improvements in the keyboard controller, PS/2 Mouse, S3 Video, Programmable Interrupt Controller – PIC and Programmable Interrupt Timer – PIT
- · Only support VHDX disks
- · Does not support physical DVD Drive passthrough, only emulated devices using ISO or any other DVD image files
- · Can use 64-bit editions of Windows 8, Windows Server 2012 or newer versions
- · Does not support legacy devices such as Legacy Network Adapters, IDE Controller, Floppy Controller and COM ports
Whenever possible, the new generation will always be the best option because the new improvements and features that we don’t have in Generation 1, but for compatibility reasons, the default option when creating a new Virtual Machine is Generation 1.