August 15, 2018
Hyper-V Generation 1 vs. 2 – Which One to Choose?
There are two generations of Hyper-V virtual machines – Generation 1 and Generation 2. The choice of VM generation is important when a VM is created; this choice is also dependent on the guest operating system, the host operating system, boot methods and other factors. Generation 2 machines are newer than Generation 1 machines, although sometimes Generation 1 machines may be required for use. This blog post explains the differences between Generation 1 and Generation 2 virtual machines, in order to help you make the right choice to meet your requirements.
Characteristics of Gen 1 VMs
BIOS is a Basic Input/Output System software that is flashed on a chip on a motherboard. BIOS is responsible for a machine’s start and hardware configuration. Gen 1 VMs support legacy BIOS-based architecture and can be loaded from MBR (Master Boot Record) virtual hard disks. A digital BIOS with virtual hardware is emulated by Hyper-V.
IDE Virtual Disks
Gen 1 VMs have a virtual IDE controller that can be used for booting a VM from the IDE virtual disk. Virtual SCSI controllers can only be recognized after installing Hyper-V Integration Services on the guest OS on the VM. The guest OS cannot boot from a SCSI disk.
A physical computer needs a set of hardware components in order to work. All required hardware components must be emulated to make the virtual machine work. Special software that can imitate the behavior of real hardware is included in Hyper-V; as a result the VM can operate with virtual devices. Emulated hardware (that is identical to real hardware) includes drivers that are catered to most operating systems in order to provide high compatibility. Among the virtual devices of Gen 1 VM you can find:
- A legacy network adapter
- A virtual floppy drive
- Virtual COM ports
Hardware Limits of Gen 1 VMs
The hardware limits for Generation 1 VMs are:
- 2 IDE controllers, each of which can attach up to 2 IDE drives
- A maximum of 4 SCSI controllers and up to 64 attached SCSI drives
- A MBR – 2TB disk with 4 partitions
- A physical DVD drive can be attached to a VM
- x86 and x64 guest OS support
Improvements of Gen2 VMs
UEFI BIOS Support. GPT Support. Secure Boot
UEFI (Unified Extensible Firmware Interface) is low-level software that, similarly to BIOS, starts after powering on the computer ahead of loading the operating system (OS). The term “UEFI BIOS” is also used for better understanding. UEFI is not just a replacement of BIOS, UEFI extends support of devices and features. Some of these are GPT (GUID Partition Table) support and Secure Boot. GPT partitioning scheme allows one to overcome the limit of 2-TB disks for which the maximum number of partitions is 4 for a MBR partitioning scheme. Secure Boot is a feature that allows protection against modifying boot loaders and main system files; this is done by comparing the digital signatures that must be trusted by the Original Equipment Manufacturer (OEM). These features are available because Hyper-V Gen 2 VMs support UEFI.
Boot from SCSI Virtual Disk. Native VMBUS Support
Gen 2 VMs can be loaded from SCSI virtual disks because UEFI supports such communication with the SCSI controller while BIOS doesn’t. The support of synthetic VMBUS drivers for synthetic hardware during VM boot allows the use of SCSI drivers at the boot. For example, Gen 1 VMs can use only legacy IDE drivers for emulated devices before a file system is initialized. Hyper-V Integration Services must be installed to enable the SCSI controller for Gen 1 VMs.
PXE Boot Option
Both Gen 1 and Gen 2 VMs support a PXE (pre-boot execution environment), which is a network boot. However, there are some manual operations that should be done to enable a PXE boot for Gen 1 VMs. A synthetic network adapter that has higher performance is added to Gen 1 VM by default, but this type of network adapter doesn’t support a network boot for Gen 1 VMs. First shut down the VM and then add an emulated legacy network adapter. After this has been done you can use PXE boot for a Gen 1 VM.
Gen 2 VMs support a network boot with a synthetic network adapter because they use UEFI, which is able to communicate with this network adapter type. Thus, you can use PXE boot for Gen 2 Hyper-V VMs without any additional tricks.
VHDX Virtual Disks
Gen 2 VMs only support a VHDX format of virtual disk files while Gen 1 VMs support both VHD and VHDX formats. VHDX format has a list of advantages including:
- Support of 4KB blocks with improved alignment
- Increased limit of maximum disk size
- Better resistance against power loss while tracking metadata
- Overall better performance of VHDX virtual disk
Copying Files from Hyper-V Host to VMs without Network Connection of VMs
There is Enhanced Session Mode for Gen 2 VMs that uses a Remote Desktop Protocol. This feature allows the sharing of local resources of the Hyper-V host with VMs, or the performance of copy/paste operations between host OS and guest OS without a network connection between Hyper-V host and guest VM. File exchange can be performed with a Graphical User Interface (VM Connect) or PowerShell (Copy-VMFile cmdlet).
Some requirements must be met:
- Hyper-V Integration Services must be installed on a VM
- Remote Desktop service must be enabled on a VM
- Guest OS must be Windows Server 2012 R2 or later/Windows 8 or later Windows version
As you can see, copying files becomes more convenient for Gen 2 VMs. For Gen 1 VMs, the only way of copying files from host OS to guest OS is copying files over the network.
VMs Boot Faster
The boot time of Gen 2 VM is about 20% faster due to the faster start of the UEFI. Installation of a guest operating system also takes up to 50% less time. Although during regular use this advantage can be unnoticeable, it may help you save time when you need to install and configure a high number of new VMs or use Virtual Desktop Infrastructure (VDI).
Fewer Devices, Synthetic Hardware
In the past, operating systems were released without the awareness of running on virtual machines. For this reason, hardware emulation is used. Gen 1 VMs use the approach of hardware emulation for maximum compatibility. The newest operating systems are aware of running on virtual machines and use VMBus instead of searching legacy controllers or chipsets. Most of the legacy-emulated devices have been removed for Gen 2 VMs, and new faster synthetic hardware is used instead. With tighter hypervisor integration and a lower number of virtual devices, VM performance may increase.
Higher CPU and RAM Limits
The maximum amount of virtual RAM and the maximum number of virtual CPU that can be assigned for a virtual machine has been increased:
1 TB RAM for Generation 1 VMs vs 12 TB RAM for Generation 2 VMs;
64 virtual processors for Generation 1 VMs vs 240 virtual processors for Generation 2 VMs.
Thus, you can use Gen 2 VMs for tasks that consume more resources. Before creating the VM, check if the version of the host operating system supports the required maximum amount of memory and maximum number of virtual processors. Windows Server 2016 has higher limits than Windows Server 2012 R2.
Requirements for Gen2 VMs
Generation 2 VMs have been released by Microsoft with Hyper-V for Windows Server 2012 R2 and Windows 8.1; hence these versions of 64-bit Windows (or later, including standalone Hyper-V Server 2012 R2) are required on the Hyper-V host for running Gen 2 VMs. Guest operating systems for Gen 2 VMs can be Windows Server 2012 or later Windows Server versions, Windows 8 x64 or above because of the support of UEFI 2.3.1 with Secure Boot option.
Advantages of Using Gen2 VMs
Let’s summarize the main advantages of using Gen 2 VMs. Gen 2 VMs provide:
- Higher performance (including higher CPU and memory limits)
- Higher security with Secure Boot and Trusted Platform Module
- More boot options such as PXE boot with synthetic network adapter, and boot from SCSI disk
- More reliable VHDX virtual hard disks with higher maximum disk size
- No 2 TB disk limit due support of UEFI with GPT
Gen 2 VMs are recommended to use in most cases, especially for modern 64-bit operating systems.
There are exceptions, when the Gen1 VM is preferable over Gen2 VM:
- Running 32-bit operating systems is only supported by Generation 1 VMs
- Using older operating systems that don’t support UEFI, or don’t have drivers for synthetic hardware (for example, Windows XP, Windows 7, Windows Server 2008 and some older Linux distributives should be run on Gen 1 VMs)
- If you need to use COM ports and virtual floppy disks in your VM, use a Gen 1 VM (there is no support of COM ports and floppy disks for Gen 2 VMs)
- Migrating a VM to Hyper-V host based on Windows Server 2012, Windows Server 2008 or Azure cloud that don’t support Gen 2 VMs
How to Create a Gen1 VM and Gen2 VM?
To create a virtual machine in GUI:
- First open Hyper-V Manager
- Click Action > New > Virtual Machine
- New Virtual Machine Wizard should open
- Specify the Name and Location for created VM before clicking “Next”
- Now you can see the “Specify Generation” screen where you can choose the generation for the virtual machine (see the screenshot below).
When the generation has been selected, click “Next” and configure other options in the wizard to finish creating the VM.
How to Convert a Gen2 VM to Gen1 VM and Vice Versa?
Microsoft doesn’t provide any tools for converting VMs from one generation to another. As a proof of this you can see a warning on the screenshot above: “Once a virtual machine has been created, you cannot change the generation”. Try to predict any possible use cases for the VM before creation, because changing a VM generation afterwards is not supported. However, there is one unofficial tool for converting Gen 1 VMs to Gen 2 VMs which is called Convert-VMGeneration. This tool doesn’t modify the source Gen1 VM. A new Gen 2 VM with a new boot disk is created during conversion process. You can use this tool at your own responsibility without any warranties.
Backup of Hyper-V VMs
Despite the generation of VMs, they should be backed up to prevent the data loss. NAKIVO Backup & Replication can back up both generations of Hyper-V virtual machines and provides the following features:
- Host level image-based backups. Virtual machines are backed up on a hypervisor level with all virtual disks and configuration files. There is no need to install backup agents on a guest VM and create an empty VM in a case of recovery. A host level backup consumes less computing resources than a guest-level backup.
- Hyper-V Screenshot Verification allows you to ensure that your VM has been successfully backed up and a guest operating system can be loaded after VM recovery. Using this feature prevents situations where a backup has been created but the VM cannot be run after recovery.
- Granular recovery allows you to recover files, directories, MS SQL objects, MS Exchange objects and Active Directory objects without recovery of the entire VM – which saves time. Files can be recovered from both Windows-based and Linux-based virtual machines directly from backups.
- Automated VM failover helps you to restore the workloads in the shortest possible time if you have a VM replica created with NAKIVO Backup & Replication. If a source VM goes offline after a possible disaster, you can fail over to a VM replica that is an identical copy of a source VM at the appropriate point in time. There is no need for editing the network settings for each VM manually during migration to a disaster recovery site of which networks differ from the source site. Network Mapping and Re-IP automate this process during the creation of a replication or a failover job.
Today’s blog post has covered two generations of Hyper-V virtual machines – Generation 1 and Generation 2. The Gen 2 VMs are more progressive because they use synthetic virtual devices, UEFI BIOS, GPT partitioning scheme, Secure Boot, PXE boot without tricks, more reliable VHDX virtual disks, and have higher hardware limits. Gen 2 VMs are preferred for use, but only 64-bit operating systems can run on them. If you need to run older operating system or 32-bit operating system, then use Gen 1 VMs which have legacy emulated virtual devices, BIOS, support of COM ports, virtual floppy disks, virtual IDE controllers, and attached physical DVD drives. It is important to try to predict all possible use cases before you create the VM because changing the generation of the VM after creation is not supported. No matter which generation you choose, NAKIVO Backup & Replication can back up your Hyper-V VMs in a fast and reliable manner.