Converting GNU/Linux Generation 1 VMs to Generation 2 on Hyper-V 2012 R2 – Part 2

Continuing with this series on Converting GNU/Linux generation 1 VMs to generation 2 on Hyper-V 2012 R2, I will go over this subjects:

  • Introduction
  • What’s new about generation 2 VMs on Hyper-V 2012 R2
  • How to convert a GNU/Linux generation 1 VM to a generation 2 VM
  • How to extend a LVM volume on GNU/Linux to use all the free space available
  • Conclusions

The idea for today’s post is to do a quick review on generation 2 VMs so you can understand which are the main differences with generation 1 VMs and the motivation behind migrating your current VMs to generation 2.

What’s new about generation 2 VMs on Hyper-V 2012 R2

One of the new features in Hyper-V 2012 R2 is the availability of two types of VMs. They are called generation 1 and generation 2. You need to decide the VM type you will use when you create a new VM and this is something you can’t easily change afterwards so you want to make the right decision.
Let’s review which are the main differences between each type and why you may want to start using generation 2 VMs.

  1. The Firmware

    In previous versions of Hyper-V we only had one type of VM, now called generation 1. It uses an emulated BIOS firmware (the kind of firmware that all the PCs used until a couple of years ago).
    BIOS is compatible with many different types of operative systems, 32-bits and 64-bits. On the other hand, since it was designed more than 30 years ago, it brings some limitations with it that especially affects newer hardware.
    For example, BIOS requires you to partition your boot drive using the Master Boot Record (MBR) partition table layout, which is limited to 2TB. This was more than enough 15 years ago, but let’s face it, you can get a 4TB or even bigger drives at any hardware store these days. It will also limit the amount of partitions on your disk to four. If you need more partitions, you will have to create one of the primary partitions as extended and create logical partitions inside it.

    Other firmware limitations of generation 1 VMs are:

    • PXE boot is only possible using legacy network adapters (which are much more slower than their syntethic counterparts)
    • Network boot is only possible using IPv4 addresses
    • It’s not possible to boot from SCSI controllers, so you need at least one IDE controller to plug your boot VHDX.

    Generation 2 VMs uses an emulated UEFI firmware, which is the kind of firmware that you can find in almost any new PC since 2012. UEFI supports MBR, but also supports the newer GUID partition table (GPT) layout, that in comparison to MBR, supports drives of up to 9.4ZB and allows you to create an almost unlimited amount of partitions on the same drive (Windows for example supports up to 128) without the need of creating extended partitions.

    Other firmware benefits of generation 2 VMs are:

    • PXE boot works with syntethic adapters
    • Network boot is possible using IPv4 and IPv6 addresses
    • It’s possible to boot from SCSI controllers (actually is the only type of controller available as we will see below)


  2. Virtual hardware devices

    Another big difference between generation 1 and generation 2 VMs comes to virtual hardware devices available for each type of VMs.
    The following virtual devices were removed from generation 2 VMs:

    • Legacy network adapter
    • IDE controller
    • Floppy controller
    • Serial controller (COM Ports)
    • i8042 keyboard controller
    • PS/2 mouse
    • S3 Video
    • Programmable Interrupt Controller (PIC)
    • Programmable Interrupt Timer (PIT)
    • PCI bus
    • Speaker
    • Numerical co-processor

At first glance you can see that a lot of emulated legacy virtual hardware was removed from generation 2 VMs and this will have a positive performance impact, since it will reduce context switches on the Hyper-V host and allow faster communication with the VM using the VM Bus.

When you may want to use generation 2 VMs and when you don’t

Of course generation 2 VMs are not a perfect fit for every scenario so the following lists are just a few examples of when you may want to use generation 2 VMs and when you don’t.

Use generation 2 VMS when:

  • You want the best performance out of your VM (less legacy emulated hardware)
  • You want to take advantage of the UEFI firmware
  • You need to PXE boot your VM but you don’t want to suffer the legacy network adapter performance penalty
  • You want to increase your VM security using Secure Boot capability (only for Windows guests)

Don’t use them when:

  • You need to run 32-bit VMs
  • Not all your Hyper-V hosts are running Windows Server 2012 R2 and you will need to move the VM among different hosts
  • You are planning to migrate your VM to Azure

In my next post we I will share the actual procedure to convert a CentOS 7 generation 1 VM into generation 2.

Leave a Reply

Your email address will not be published. Required fields are marked *