John Howard - Senior Program Manager in the Hyper-V team at Microsoft

Senior Program Manager, Hyper-V team, Windows Core Operating System Division.

Hyper-V generation 2 virtual machines – part 7

Hyper-V generation 2 virtual machines – part 7

  • Comments 11
  • Likes

Part 1: Introduction to generation 2 virtual machines
Part 2: Networking and boot order
Part 3: Storage
Part 4: Keyboard for Windows 8 & Windows Server 2012
Part 5: Kernel debugging
Part 6: Secure Boot
Part 7: FAQ
Part 8: Manually migrating generation 1 virtual machines to generation 2
Part 9: Installing from ISO
Part 10: Utility for converting generation 1 virtual machines to generation 2 (Convert-VMGeneration)

This part of the series on generation 2 virtual machines provides answers to general questions. Most, I provided to our writers a little while ago, and have since worked their way into official documentation at http://technet.microsoft.com/en-us/library/dn282285.aspx. Technet documentation can sometimes deliberately be a little sparse, so I’ve augmented some of the answers where appropriate. Some of these Q&As have already been mentioned in previous parts, but it makes sense to keep them all in one spot.

These are in no particular order.

Q: How can I do kernel debugging of a generation 2 virtual machine?

A: See part five for a detailed answer.

Q: During installation of Windows 8 64-bit or Windows Server 2012, the keyboard is not active


A: See part four for a detailed answer.

Q: Is RemoteFX supported by generation 2 virtual machines?


A: No. The reason is that there is a dependency on PCI in the RemoteFX stack. PCI is not present in generation 2 virtual machines, and it was not possible to remove this dependency in the timeframe and resources available for the Windows 8.1 release cycle.

Q: Why can’t I use a physical CD/DVD in a generation 2 virtual machine?


A: We dropped support for physical CD/DVD passthrough in generation 2 virtual machines as the majority of end users now use .ISO files, or build VMs from templates. Physical device support is also problematic in migration scenarios. The new SCSI DVD drive in generation 2 virtual machines supports features not supported by the IDE DVD drive such as hot-add remove, and is not limited to a maximum of four devices.

Q: Can I use .VHDs in a generation 2 virtual machine?


A: Without conversion, no. But see following Q&As also. VHDs are not supported in generation 2 virtual machines, only VHDX files are. You can convert an existing VHD used by a generation 1 virtual machine to a VHDX using the Convert-VHD cmdlet, and use that in certain scenarios in a generation 2 VM.

Q: Will a VHD converted to VHDX work in a generation 2 virtual machine?


A: If it is a data disk (ie not an OS bootable disk), then absolutely. If it is an OS bootable disk, then it can be used as a data disk but will not boot, even if the guest operating system is one which is supported by generation 2 virtual machines. A clean operating system installation is required in this scenario along with application migration.

Q: Can I attach a VHDX from a generation 2 virtual machine to a generation 1 virtual machine?


A: Absolutely. VHDX is just a disk container, so there is nothing stopping you attaching it as a data disk to a generation 1 virtual machine and using a different guest operating system to examine the contents. Of course, it requires that the guest operating system is aware of the file system in that VHDX.

Q: Can I perform a network installation in a generation 2 virtual machine using IPv6?


A: Absolutely. In an elevated PowerShell prompt, run Set-VMFirmware –VMName <Name of VM> -IPProtocolPreference IPv6. Note that this will change the protocol for ALL network adapters in the VM – you cannot for example have the VM attempt an IPv4 boot from the first network adapter, and IPv6 on the second network adapter.

Q: How can I programmatically determine the generation of a virtual machine?


A: See part one of this series for examples

Q: Can I still use a virtual floppy disk to contain an unattended install answer file in a generation 2 virtual machine?


A: No as floppy disk drive support is not present in generation 2 virtual machines. However, unattended installation supports alternate removable media including .ISO files which can be placed in a virtual DVD drive.

Q: Can I iSCSI boot a generation 2 virtual machine?


A: No, you can only boot from SCSI-attached disk, .ISO attached to a CD/DVD device, or from network

Q: Can I boot a generation 2 virtual machine from a virtual FC adapter?


A: No, you can only boot from SCSI-attached disk, .ISO attached to a CD/DVD device, or from network

Q: Can I use large VHDX files in generation 2 virtual machines.


A: Absolutely, all the way up to the limit of 64TB imposed by VHDX. Large VHDXs can be used as both boot and data disks.

Q: Can I “loopback mount” (ie expose in the parent partition) a VHDX used by a generation 2 virtual machine?


A: Absolutely. A VHDX is a file format and not tied to a specific virtual machine generation. As such, you can loopback mount a generation 2 virtual machines VHDX exactly the same as for a generation 1 virtual machine.

Q: Can I create a VHDX which can be used to boot both a generation 1 and 2 virtual machine?


A: Technically, this is possible. In fact, Windows to go in Windows 8 Enterprise used such a mechanism to craft a disk layout which works exactly in this way. However, there are limitations, not the least of which is that in the Hyper-V scenario, we have not tested this, neither is it supported. Some of the limitations include the inability to perform service pack installation or operating system upgrade. Additional side effects would be that duplicate BCD stores are required, and mirroring between them is not honoured. Hence some updates may be lost.

Q: Can I export a generation 2 virtual machine from a Windows 8.1/Windows Server 2012 R2 server, and import it into/start it on a machine running Windows 8 or Windows Server 2012 Hyper-V?


A: No, as generation 2 virtual machines are a new feature in Windows 8.1 & Windows Server 2012 R2.

Q: What is the dependency between UEFI in a generation 2 virtual machine and the physical platform firmware?


A: None. The firmware exposed in a Hyper-V virtual machine (mostly) has no correlation to the firmware on the physical platform. Hence there is no requirement for the physical server to have UEFI firmware or support Secure Boot to support both of these features in a generation 2 virtual machine.

Q: Do generation 2 virtual machines support Measured Boot?


A: No. But they support the closely related Secure Boot capability. Measured Boot has a dependency on a TPM (Trusted Platform Module) which is not present in a generation 2 (or generation 1 for that matter) virtual machine.

Q: Can I run <insert arbitrary UEFI application> in a generation 2 virtual machine?


A: Probably, although it is unsupported and untested. We don’t, for example, provide a UEFI shell or other applications which almost certainly would run in a generation 2 virtual machine, assuming that secure boot was disabled for that VM. The only “UEFI applications” (used loosely) we support in a generation 2 virtual machines are operating system loaders for supported operating systems.

Q: Where is Secure Boot setup mode for a generation 2 virtual machine?


A: We only support user mode. PK/KEK and the global db/dbx variables cannot be updated. See part six of this series for detailed information on Secure Boot.

Q: Where are NVRAM variables held?


A: On a physical UEFI platform, non-volatile memory is used to store variables. In Hyper-V, NVRAM variables are stored (for the most part, and part 6 has more information on Secure Boot variables) in the configuration file for the virtual machine. NVRAM variables include, but are not limited to, boot entries. Note this is quite different to generation 1 virtual machines.

Q: Can I use a passthrough (physical) disk in a generation 2 virtual machine?


A: Yes. However, we strongly recommend these are not used unless absolutely necessary. It is possible that passthrough disk support may be deprecated in a future release. In reality, the fixed VHDX file format has comparable I/O performance, so there really is little need for the use of a passthrough disk.

Q: What is the default generation of a new virtual machine?


A: The default generation is 1 so that we didn’t break backwards compatibility with existing scripts. In PowerShell, to create a generation 2 virtual machine, use “–Generation 2” as a parameter to New-VM.

Q: How can I change the generation of an existing virtual machine


A: This is not possible (at least inbox). Generally a clean install and application migration is required. This topic will be covered in a lot more detail in part eight.

Q: Is it possible to run both generation 1 and generation 2 virtual machines on the same server.


A: Absolutely. This is entirely possible and fully supported.

Q: Windows installation fails in a generation 2 virtual machine


A: Make sure your VM has the minimum amount of memory assigned according to the requirements of the operating system. (Unfortunately, creating a new virtual machine using the defaults in the new virtual machine wizard and the New-VM cmdlet is 512MB which is less than the required memory for Windows 8 and Windows 8.1 and their server counterparts.)

Q: Why don’t we support 64-bit Windows 7 or Windows Server 2008 R2 as a guest operating system in generation 2 virtual machines?


A: Certainly it is true that Windows 7 support UEFI, the first requirement for generation 2 virtual machines. However, Windows 7 has a hardware dependency on a Programmable Interrupt Controller (PIC) which is not present in generation 2 virtual machines. Even if Secure Boot is disabled, an attempt to install Windows 7 will result in an apparent hang at “Starting Windows” shortly after boot, consuming 100% VP utilisation. A similar effect to this will be seen if attempting a network install from a WDS server which has a Windows 7 era boot PE image – network boot will appear to hang as well. For that reason (along with the keyboard issue in Windows 8 PE) I strongly recommend any WDS server are upgraded to the Windows 8.1 PE boot image.

Q: When is Linux going to be supported in a generation 2 virtual machine


A: Linux support is being worked on as of writing. Currently, 64-bit versions of Windows 8 and 8.1, or Windows Server 2012 and Windows Server 2012 R2 are supported guest operating systems.

Q: I can install Windows 8 and 8.1 32-bit on my OEM UEFI computer. Why doesn’t it install in a generation 2 virtual machine?


A: See part one of this series. Our UEFI implementation is “Class 3” and does not have a Compatibility Support Module. In Hyper-V, 32-bit guest operating systems are only supported in generation 1 virtual machines.

Q: How many network adapters can a generation 2 virtual machine have?


A: Eight. Generation 2 virtual machines do not support legacy network adapters. (Note in generation 1 virtual machines, legacy network adapters are only recommended for use during network installation of the guest operating system)

Q: Will application “A” run the same in a generation 2 virtual machine as it does in a generation 1 virtual machine?


A: Yes. From a generic application perspective, there is no difference between VM generation. It’s no different to asking if the application will run the same on both an EFI and BIOS based physical machine.

Q: I use virtual switch extension “X” from vendor “Y”. Will it still work with generation 2 virtual machines?


A: Yes, switch extensions are entirely on the parent partition side. Switch extensions are agnostic of, and orthogonal to the virtual machine generation.

Q: How many SCSI storage devices can I attach to a generation 2 virtual machine?


A: A generation 2 virtual machine can have up to 4 SCSI controllers, each with 64 devices attached. Hence the maximum is 256. Note that this can be made up of any combination of VHDX, passthrough disk (see caveat in previous Q&As) or CD/DVD. Generation 2 virtual machines are not limited to four CD/DVD devices in the same way that generation 1 virtual machines are.

Q: Why doesn’t a newly created generation 2 VM boot from a Windows ISO automatically when a generation 1 VM did?


A: See part nine of this series. Sorry to keep you in suspense ;)

Q: What about performance comparisons between generation 1 and generation 2 virtual machines?


A: First the official answer. “Do not expect any performance differences between generation 1 and 2 virtual machines.” And this is certainly true at run-time when a guest workload is doing what it does, for both server and client operating systems. However, and explicitly NOT quoting numbers as they are not relevant, you may see increased performance in two areas.

  1. During guest operating system boot. There are a couple of reasons for this. One is that our UEFI firmware initialises faster than our PCAT BIOS. Also in a generation 1 virtual machine, during the initial part operating system start, while the storage fast-path filter is not loaded in the guest, I/O is using emulation which has more overhead. Generation 2 virtual machines always use VMBus for I/O.
  2. During guest operating system installation from ISO or network. For the same reasons as above, there is no emulation required.

 

Q: I’ve developed a WMI or PowerShell script using documented Hyper-V APIs. Will it work with generation 2 virtual machines?


A: Possibly! However, the modifications needed should be minor if they don’t work. The main areas where scripts may need modification:

  • Take account of New-VM with the generation parameter and the corresponding attribute on Get-VM; In WMI it’s the VirtualSystemSubType field in the Msvm_VirtualSystemSettingData class you need to be aware of. See part one for more information.
  • Anywhere you use Set-VMBios needs replacing with appropriate calls to Set-VMFirmware;
  • Any references to legacy NIC will fail. Use a software based network adapter instead.
  • References to IDE based storage will fail (eg Get-VMHardDiskDrive). Use the SCSI equivalent instead.

 

Q: What generation should I choose when creating a new virtual machine?


A: Well really this depends on too many things to be prescriptive. There is no single right answer and my answer below should be taken as non-exhaustive examples of thoughts you should have when making the choice.

In this answer, I’m constraining myself to just Hyper-V functionality. This means I will not be considering any higher level management layers, integration, processes, template/library, third party applications support (backup for example – does it support EFI systems?), public cloud, or any other IT infrastructure you may have in place. Nor am I considering heterogeneous virtualization environments, whether that means interoperability/interchange with previous versions of Hyper-V or any other virtualization platform. You should however NOT ignore any of these, or other potentially relevant consideration!

  • Obviously, the guest operating system and architecture must be supported by generation 2 VMs.
  • Consider the improvements to generation 2 VMs and see if you answer yes to any of these example questions: Is Secure Boot important to you? Is a reduced attack surface important to you? Are the performance characteristics mentioned above important to you? Do you require IPv6 network installation? Am I likely to need to expand the boot disk of a VM at run time?
  • Consider the longer term direction Microsoft is going to move to (given we are more likely to invest in newer capabilities that are generation 2 specific in future releases). Does it make sense to embrace generation 2 VMs now knowing they will be with us for a long while to come?
  • Consider the Hyper-V features you use. Unless the VM requires RemoteFX, everything you can do in a generation 1 VM, you can also do in a generation 2 VM.
  • After that, it comes down to a case of the end-user scenario. I’ll give two broad examples – a generic server and a generic client role.
    • Server: Windows Server 2008 was the last shipped version of Windows Server available in 32-bit. However, given Windows Server 2008 is not supported in generation 2 VMs, to all intents and purposes, for Windows Server, this means you are deploying a 64-bit operating system. There is little reason not to deploy Windows Server 2012 or 2012 R2 as a generation 2 VM with one exception. That being the case of replica to Windows Azure as generation 2 VMs are not currently supported by Windows Azure.
    • Client: From a memory perspective, 64-bit operating systems tend to use more memory than their 32-bit counterparts. Hence your overall memory footprint may be more using generation 2 virtual machines. However, please remember the many advantages in 64-bit Windows which may well outweigh the additional memory requirements.

 

Q: OK, so I’ll move to generation 2. But am I going to have to go through the same in a future release with generation 3?


A: Well anything is possible, and as you know, I can’t talk about anything we haven’t released. However, the reason for generation 2 was to build a platform for the future, so they will be with us for a long while yet. As the underlying firmware is so different between generation 1 and generation 2, realistically it’s unlikely we would introduce a generation 3 unless there’s a UEFI replacement round the corner, or there’s some truly fundamental other hardware change we need to do to the virtual machine container. It’s reasonably safe to say moving to generation 2 will get you to the point where newer Hyper-V features in future releases are more likely to light up in generation 2 virtual machines, and less likely to be enabled for generation 1 virtual machines.

 

The next topic in this series is a big one. Start your coffee brewing now. It’s all about manually converting a generation 1 virtual machine to generation 2.

Cheers,
John.

Comments
  • You forgot to update the link list at the top of older posts :o( I kept staring at the list where blue items end at Part 6. Just out of curiosity I tried manually editing the address and it worked! As I am the first to leave a comment it is possible that I am not the only mislead one.

    I am still waiting for Part 9.. Turning blue meanwhile.. Two more to go..

  • Me too...why not release part 9 first but not update the links in old posts before you publish part 8 :)

  • They're updated now. Won't be long to go.... And looks like there'll be a part 11 too.

  • You also forgot to mention that Generation 2 VM's cannot be used as virtual desktop template for virtual desktop collections .....

  • I beg to differ on pass through IO. I quote: " In reality, the fixed VHDX file format has comparable I/O performance, so there really is little need for the use of a passthrough disk." On a HP xw9400 dedicated as a hyper-V host, using 3ware 9550 for hardware RAID10 array, I was hitting performance wall on SQL VMs. On a fixed size data partition, I was getting 45 seconds to 2 minutes on certain queries - I've been a DBA 15 years, used all the tricks I know of and I couldn't do better than 45 seconds. I added couple drives of the same type to the array, made RAID 1 (just mirrored) and used it as pass-through in hyper-V.

    That alone got me to 30 seconds, much like physical box. So, my experience says - supposedly faster RAID 10 (proven by CrystalDiskMark, it actually IS faster than RAID1 of the same drives), burdended by VHDX overhead, was completely beaten by RAID1 - a pair of the same physical drives with no benefit from hardware striping, the only difference being fixed size VHDX vs pass through. (Caviat: this test is not 100% fair because now the SQL mdf access has its own IO path...but my gut feel says it is still faster. RAID1 beating RAID10 on the same drives/adapters mean something to me)

    Perhaps, having dedicated hardware RAID adapter worked in favor of pass through IO?

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment