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 3

Hyper-V generation 2 virtual machines – part 3

  • Comments 6
  • 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)

In the previous part, I explained about management as it relates to network in generation 2 VMs and also talked about the boot order settings. In this part, I’m going to follow a similar theme, but apply it to storage. And introduce a long-asked for feature which is new to Hyper-V in Windows 8.1 & Windows Server 2012 R2

Boot from SCSI

Recapping slightly, as mentioned in part one, the emulated IDE controller is no longer present in a generation 2 VM. To boot from disk, we have made it possible in a generation 2 VM to boot from a SCSI controller – more specifically VHDX’s or ISOs added to a SCSI controller.

Note – the ability to boot from SCSI is a feature in our UEFI firmware, not the SCSI controller itself. In other words, even though generation 1 VMs also support SCSI controllers and VHDX’s (but not DVDs) being attached to them, you cannot boot a generation 1 VM from a device attached to a SCSI controller.

It is not possible to boot a generation 2 (or generation 1) virtual machine from storage attached to a virtual fibre channel adapter.


Generation 2 VMs only support VHDXs – they do not support VHDs. However, you can convert a VHD to a VHDX using the Convert-VHD cmdlet. This will work for data disks if you are migrating existing VMs to generation 2 VMs. However, it will not work as expected for boot disks. The boot disk will convert fine in terms of the VHD/VHDX file format, but will not boot after conversion in a generation 2 VM as the partition layout and boot configuration will not be correct for UEFI. I will talk more about migration in a later part, but you will need to clean install the guest operating system to move to a generation 2 VM.

IDE Controller overhead

The IDE controller in a generation 1 virtual machine supports 48-bit LBA, and switches to that mode if the VHD is larger than approximately 137GB. Regardless of mode, what this means is that during a guest operating system boot, each I/O involves 6 (9 if 48-bit LBA) round trips through the hypervisor, the parent partition kernel mode, parent partition user mode and device emulation inside the worker process to complete. This is actually quite a significant overhead in terms of compute cycles, and also causes the guest VPs to be paused during this emulation path. Once the guest operating system has got sufficiently far through boot, our fast path filter for the I/O path comes online at which point we switch to software based I/O over VMBus which is far more efficient.

With native support for VMBus in our UEFI firmware in a generation 2 VM, no emulation is necessary to boot a VM from a VHDX or ISO attached to a virtual SCSI controller. Hence initial boot performance is far more efficient.

Disk layouts

In a generation 1 VM, the boot disk must have an MBR partition table. This is a requirement of our PC-AT BIOS. Data disks in a generation 1 VM can be GPT. Technically, the boot disk for a generation 2 VM (or EFI machine) can be MBR or GPT, as long as there is an EFI system partition present with a boot loader. However, it is strongly recommended that you use GPT on a UEFI based machine. The Windows ADK has information on the recommended disk partitioning structure.

When you run setup installing Windows, it will lay out the partitions on the boot disk appropriately, automatically using GPT in the case of a generation 2 VM. What does this mean in reality? Well not a lot to most users as the disk layout will largely be irrelevant. However, there is a difference in terms of maximum size of the boot volume. For a generation 1 VM, the boot volume can be a maximum of 2TB in size (assuming you are using VHDX as VHD is limited to 2040GB). If the VHDX is greater than 2TB, any remaining space can still optionally be used as a data volume for generation 1. For a generation 2 VM, the boot volume can be a maximum of 64TB in size, which is also the maximum disk size supported by a VHDX.

Hot or online expand

While this next point isn’t strictly directly related to generation 2 VMs, because of supporting SCSI boot, generation 2 VMs can be a little more dynamic in nature, reducing downtime. New to Windows 8.1/Windows Server 2012 R2 Hyper-V is the ability to expand a VHDX while it is use. This means that is it possible to expand not just a data disk, but the boot volume too. This is potentially useful in a private/public cloud scenario as it eliminates downtime for customer requests for more storage.

Online expand is found through the “Edit Disk Wizard” in Hyper-V Manager or the Resize-VHD PowerShell cmdlet. Note that after expanding a VHDX, it will be necessary to use diskmgmt.msc inside the guest operating system to extend the file system to use the extra space.

Hot Add/Remove Disks

I’m including this more as an ‘end user be beware’ of this feature as it applies to generation 2 VMs. We have supported hot add and remove of disks to SCSI controllers for a while. However, the downside is that it is possible to remove the system disk from a running VM at run time. In the case of Windows, this has the potential for a VM to crash should it, for example, attempt to access the page file and hit an I/O error. This is something we hope to look at addressing in the future. It’s actually not as trivial as it sounds to get right, hence it did not make it into this release.


Moving on to another aspect of storage relating to generation 2 VMs, let’s talk about the DVD device. This is a brand new software-based DVD device which can only be used on a SCSI controller. Someone will ask, so worth mentioning…: Even though a generation 1 VM supports a SCSI controller, you cannot use the SCSI DVD on a generation 1 VM.

There are a few differences between DVD support between generation 1 and generation 2 VMs

  • Generation 1 has a DVD device attached to the IDE controller 1 by default. Unless you specify to install from a bootable ISO in the new virtual machine wizard, generation 2 VMs do not have a DVD device added by default. This was a conscious design decision.
  • The DVD device in a generation 1 VM cannot be removed (although media can be removed from the device) while the VM is powered on. The DVD device in a generation 2 VM can be hot-added and hot-removed.
  • The DVD device in a generation 2 VM does not support physical drive passthrough. Again, this was a conscious design decision driven primarily by user data which indicated that very few people used physical media. Further, physical media does not survive live migration.
  • There is a limit of 4 DVD devices possible in a generation 1 VM (two on each IDE controller). For generation 2, the limit is 256 (4 SCSI Controllers x 64 drives). Bonus points if someone can come up with a valid/uncontrived end user scenario that actually requires this though. It was simply a case of being more work to validate limiting the maximum number of devices rather than just let it ride.


In the next part, I’ll talk about the keyboard device. Advance warning to those following along, install the ADK now (link is above) ;)


  • Can you summarize when TRIM commands are passed down to the physical storage, in the different scenarios: gen1-vs-gen2, vhdx-vs-passthrough(to a partition)?

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