Should I create a generation 1 or 2 virtual machine in Hyper-V?

Applies to: Windows 10, Windows 11, Windows Server 2016, Microsoft Hyper-V Server 2016, Windows Server 2019, Microsoft Hyper-V Server 2019, Windows Server 2022, Azure Stack HCI

Note

If you plan to ever upload Windows virtual machines (VMs) from on-premises to Microsoft Azure, both generation 1 and generation 2 VMs are supported as long as they use the VHD file format and have a fixed (not dynamically expanding) sized disk. See Generation 2 VMs on Azure to learn more about generation 2 capabilities supported on Azure. For more information on uploading a Windows VHD or VHDX, see Prepare a Windows VHD or VHDX to upload to Azure.

Your choice to create a generation 1 or generation 2 virtual machine depends on which guest operating system you want to install and the boot method you want to use to deploy the virtual machine. We recommend that you create a generation 2 virtual machine to take advantage of features like Secure Boot unless one of the following statements is true:

  • You're using an existing, pre-built virtual disk (VHD or VHDX), which isn't compatible with UEFI.
  • Generation 2 doesn't support the operating system you want to run on the virtual machine.
  • Generation 2 doesn't support the boot method you want to use.

For more information about what features are available with generation 2 virtual machines, see Hyper-V feature compatibility by generation and guest.

You can't change a virtual machine's generation after you've created it. So, we recommend that you review the considerations here, as well as choose the operating system, boot method, and features you want to use before you choose a generation.

Which guest operating systems are supported?

Generation 1 virtual machines support most guest operating systems. Generation 2 virtual machines support most 64-bit versions of Windows and more current versions of Linux and FreeBSD operating systems. Use the following sections to see which generation of virtual machine supports the guest operating system you want to install.

Windows guest operating system support

The following table shows which 64-bit versions of Windows you can use as a guest operating system for generation 1 and generation 2 virtual machines.

64-bit versions of Windows Generation 1 Generation 2
Windows Server 2022
Windows Server 2019
Windows Server 2016
Windows Server 2012 R2
Windows Server 2012
Windows Server 2008 R2
Windows Server 2008
Windows 11
Windows 10
Windows 8.1
Windows 8
Windows 7

The following table shows which 32-bit versions of Windows you can use as a guest operating system for generation 1 and generation 2 virtual machines.

32-bit versions of Windows Generation 1 Generation 2
Windows 10
Windows 8.1
Windows 8
Windows 7

CentOS and Red Hat Enterprise Linux guest operating system support

The following table shows which versions of Red Hat Enterprise Linux (RHEL) and CentOS you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Operating system versions Generation 1 Generation 2
RHEL/CentOS 8.x series
RHEL/CentOS 7.x series
RHEL/CentOS 6.x series
Note: Only supported on Windows Server 2016 and above.
RHEL/CentOS 5.x series

For more information, see CentOS and Red Hat Enterprise Linux virtual machines on Hyper-V.

Debian guest operating system support

The following table shows which versions of Debian you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Operating system versions Generation 1 Generation 2
Debian 10.x (buster) series
Debian 9.x (stretch) series
Debian 8.x (jessie) series
Debian 7.x (wheezy) series

For more information, see Debian virtual machines on Hyper-V.

FreeBSD guest operating system support

The following table shows which versions of FreeBSD you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Operating system versions Generation 1 Generation 2
FreeBSD 12 to 12.1
FreeBSD 11.1 to 11.3
FreeBSD 11
FreeBSD 10 to 10.3
FreeBSD 9.1 and 9.3
FreeBSD 8.4

For more information, see FreeBSD virtual machines on Hyper-V.

Oracle Linux guest operating system support

The following table shows which versions of Red Hat Compatible Kernel Series you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Red Hat Compatible Kernel Series versions Generation 1 Generation 2
Oracle Linux 8.x series
Oracle Linux 7.x series
Oracle Linux 6.x series

The following table shows which versions of Unbreakable Enterprise Kernel you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Unbreakable Enterprise Kernel (UEK) versions Generation 1 Generation 2
Oracle Linux UEK R3 QU3
Oracle Linux UEK R3 QU2
Oracle Linux UEK R3 QU1

For more information, see Oracle Linux virtual machines on Hyper-V.

SUSE guest operating system support

The following table shows which versions of SUSE you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Operating system versions Generation 1 Generation 2
SUSE Linux Enterprise Server 15 series
SUSE Linux Enterprise Server 12 series
SUSE Linux Enterprise Server 11 series
Open SUSE 12.3

For more information, see SUSE virtual machines on Hyper-V.

Ubuntu guest operating system support

The following table shows which versions of Ubuntu you can use as a guest operating system for generation 1 and generation 2 virtual machines.

Operating system versions Generation 1 Generation 2
Ubuntu 20.04
Ubuntu 18.04
Ubuntu 16.04
Ubuntu 14.04
Ubuntu 12.04

For more information, see Ubuntu virtual machines on Hyper-V.

How can I boot the virtual machine?

The following table shows which boot methods are supported by generation 1 and generation 2 virtual machines.

Boot method Generation 1 Generation 2
PXE boot by using a standard network adapter
PXE boot by using a legacy network adapter
Boot from a SCSI virtual hard disk (.VHDX) or virtual DVD (.ISO)
Boot from IDE Controller virtual hard disk (.VHD), virtual DVD (.ISO) or a physical CD/DVD drive
Boot from virtual floppy (.VFD)

What are the advantages of using generation 2 virtual machines?

Here are some of the advantages you get when you use a generation 2 virtual machine:

  • Secure Boot

    This is a feature that verifies the boot loader is signed by a trusted authority in the UEFI database to help prevent unauthorized firmware, operating systems, or UEFI drivers from running at boot time. Secure Boot is enabled by default for generation 2 virtual machines. If you need to run a guest operating system that's not supported by Secure Boot, you can disable it after the virtual machine's created. For more information, see Secure Boot.

    To Secure Boot generation 2 Linux virtual machines, you need to choose the UEFI CA Secure Boot template when you create the virtual machine.

  • Larger boot volume The maximum boot volume for generation 2 virtual machines is 64 TB. This is the maximum disk size supported by a .VHDX. For generation 1 virtual machines, the maximum boot volume is 2 TB for a .VHDX and 2040 GB for a .VHD. For more information, see Hyper-V Virtual Hard Disk Format Overview.

    You may also see a slight improvement in virtual machine boot and installation times with generation 2 virtual machines.

What's the difference in device support?

The following table compares the devices available between generation 1 and generation 2 virtual machines.

Generation 1 Device Generation 2 Replacement Generation 2 Enhancements
IDE controller Virtual SCSI controller Boot from .VHDX (64 TB maximum size, and online resize capability)
IDE CD-ROM Virtual SCSI CD-ROM Support for up to 64 SCSI DVD devices per SCSI controller.
Legacy BIOS UEFI firmware Secure Boot
Legacy network adapter Synthetic network adapter Network boot with IPv4 and IPv6
Floppy controller and DMA controller No floppy controller support N/A
Universal asynchronous receiver/transmitter (UART) for COM ports Optional UART for debugging Faster and more reliable
i8042 keyboard controller Software-based input Uses fewer resources because there's no emulation. Also reduces the attack surface from the guest operating system.
PS/2 keyboard Software-based keyboard Uses fewer resources because there's no emulation. Also reduces the attack surface from the guest operating system.
PS/2 mouse Software-based mouse Uses fewer resources because there's no emulation. Also reduces the attack surface from the guest operating system.
S3 video Software-based video Uses fewer resources because there's no emulation. Also reduces the attack surface from the guest operating system.
PCI bus No longer required N/A
Programmable interrupt controller (PIC) No longer required N/A
Programmable interval timer (PIT) No longer required N/A
Super I/O device No longer required N/A

More about generation 2 virtual machines

Here are some additional tips about using generation 2 virtual machines.

Attach or add a DVD drive

  • You can't attach a physical CD or DVD drive to a generation 2 virtual machine. The virtual DVD drive in generation 2 virtual machines only supports ISO image files. To create an ISO image file of a Windows environment, you can use the OScdimg command line tool. For more information, see Oscdimg Command-Line Options.
  • When you create a new virtual machine with the New-VM Windows PowerShell cmdlet, the generation 2 virtual machine doesn't have a DVD drive. You can add a DVD drive while the virtual machine is running.

Use UEFI firmware

  • Secure Boot or UEFI firmware isn't required on the physical Hyper-V host. Hyper-V provides virtual firmware to virtual machines that is independent of what's on the Hyper-V host.
  • UEFI firmware in a generation 2 virtual machine doesn't support setup mode for Secure Boot.
  • We don't support running a UEFI shell or other UEFI applications in a generation 2 virtual machine. Using a non-Microsoft UEFI shell or UEFI applications is technically possible if they're compiled directly from the sources. If these applications aren't appropriately digitally signed, you must disable Secure Boot for the virtual machine.

Work with VHDX files

  • You can resize a VHDX file that contains the boot volume for a generation 2 virtual machine while the virtual machine is running.
  • We don't support or recommend that you create a single virtual disk (VHD or VHDX file) that is bootable to both generation 1 and generation 2 virtual machines. Instead, create bootable VHDX files that target only generation 1 or generation 2 virtual machines.
  • The virtual machine generation is a property of the virtual machine, not a property of the virtual hard disk. So you can't tell if a VHDX file was created by a generation 1 or a generation 2 virtual machine.
  • A VHDX file created with a generation 2 virtual machine can be attached to the IDE controller or the SCSI controller of a generation 1 virtual machine. However, if this is a bootable VHDX file, the generation 1 virtual machine won't boot.

Use IPv6 instead of IPv4

When you boot from network with PXE, generation 2 virtual machines use IPv4 by default. To use IPv6 instead, run the Set-VMFirmware Windows PowerShell cmdlet. For example, the following command sets the preferred protocol to IPv6 for a virtual machine named TestVM:

Set-VMFirmware -VMName 'TestVM' -IPProtocolPreference IPv6

Add a COM port for kernel debugging

COM ports aren't available in generation 2 virtual machines until you add them. You can do this with Windows PowerShell or Windows Management Instrumentation (WMI). These steps show you how to do it with Windows PowerShell.

To add a COM port:

  1. Disable Secure Boot. Kernel debugging isn't compatible with Secure Boot. Make sure the virtual machine is in an Off state, then use the Set-VMFirmware cmdlet. For example, the following command disables Secure Boot on virtual machine TestVM:

    Set-VMFirmware -VMName 'TestVM' -EnableSecureBoot Off
    
  2. Add a COM port. Use the Set-VMComPort cmdlet to do this. For example, the following command configures the first COM port on virtual machine, TestVM, to connect to the named pipe, TestPipe, on the local computer:

    Set-VMComPort -VMName 'TestVM' -Number 1 -Path '\\.\pipe\TestPipe'
    

Note

Configured COM ports aren't listed in the settings of a virtual machine in Hyper-V Manager.

See Also