Register for Semperis' Hybrid Identity Protection (HIP) Conference - June 30 - July 1 Register for Semperis' Hybrid Identity Protection (HIP) Conference - June 30 - July 1
Hyper-V

Hyper-V Virtual Machine Storage Controllers Explained

In this post I will explain the role and types of storage controllers that are included in generations 1 and 2 Hyper-V virtual machines. Windows Server 2008 R2 Hyper-V was not considered for this article.

What Does a Virtual Storage Controller Do?

Every virtual machine has at least one storage controller. The role of the storage controller is to connect the virtual machine to some kind of disk. This disk could be a passthrough disk or a VHD/VHDX virtual hard disk. Since Windows Server 2012, a generation 1 virtual machine has had two IDE controllers and one SCSI controller.

To be clear, the storage controllers of a virtual machine have absolutely nothing to do with the storage controllers of the host. The IDE or SCSI controllers in the specification of a virtual machine have no dependency or interaction with the storage controllers of your hardware. The controllers are logical connections between the running state of the virtual machine and the virtual hard disk or LUN that contains an operating system and/or data. And no, you are not storing Hyper-V files/data on actual IDE controllers.

Types of Controllers

Like IDE in a classic PC, each IDE controller has two available channels, known as locations in Hyper-V. You can think of these locations as targets. If you check the BIOS settings of a generation 1 virtual machine, you will see the CD is first and IDE is second. That IDE entry refers to location 0 on IDE Controller 0. In a generation 1 virtual machine, the boot disk that will contain the OS must be connected to location 0 on IDE Controller 0.

This fact was used by Hyper-V haters in the early days of Hyper-V: “How could an enterprise virtual machine use an IDE controller?” The fact was that it was a logical connection and nothing more. Ben Armstrong (aka the Virtual PC Guy, and principal program manager lead of Hyper-V) explained why the use of an IDE controller made no impact on performance.

The simulated DVD drive is also attached to the IDE controller. Note that this device allows you to mount ISO files and to pass through a DVD drive in the host (which you rarely find these days).

The IDE controller of a Generation 1 Hyper-V virtual machine
The default controllers of a Hyper-V generation 1 virtual machine.

A strongly recommended best practice is for generation 1 virtual machines to be created as follows:

  • Guest OS: should be in a virtual hard disk on IDE Controller 0, Location 0.
  • Paging File: Should be in a virtual hard disk on IDE Controller 0, Location 1. This allows you to exclude it from Hyper-V Replica.
  • Data disks: One or more data disks should be located on virtual SCSI controllers. The benefit of this is that you get the extra functionality that VHDX and/or SCSI controllers can offer, such as live resizing of VHDX files.

Generation 1 virtual machines have a SCSI controller by default. You can have up to four virtual SCSI controllers in a virtual machine. Each controller has 64 locations or targets. Each target could have a 64 TB VHDX file. In theory you could have 256 * 64 TB of virtual storage for data in a virtual machine!

Note that some have encountered bugs by removing unwanted SCSI controllers or DVD drives from their virtual machines. My advice is that you leave them attached even if they are unused.

Generation 2 Virtual Machines

Microsoft stripped down and modernized the virtual hardware of a Hyper-V virtual machine to give us something new for the future. Things are a lot simpler in generation 2 virtual machines. There are no IDE controllers. You get one SCSI controller per generation 2 virtual machine out of the box, expandable to four, and you boot your virtual machine from Location 0 of that SCSI Controller 0. There are two notes here:

  • Benefits of SCSI: All the added features of SCSI controllers are available to this boot disk, such as live expansion of VHDX files.
  • Best practices: We still recommend placing the guest OS

By default, you do not get a virtual DVD drive. You can add a virtual DVD drive to a SCSI controller in the virtual machine. Note that this DVD drive supports only ISO images; you cannot pass through a physical drive. That’s not really such an issue. Who pays extra for DVD drives in their hosts? Most software is downloaded in ISO format. And we typically store/share those ISO files from some kind of file share library, such as System Center Virtual Machine Manager (SCVMM).

SCSI controller on a Generation 2 Hyper-V Virtual Machine
The generation 2 virtual machine storage controller

Application Best Practices

While we have generic best practices (as documented above), you should always consult the virtualization guidance of your operating system, OS role/feature, or application for the best practices of that software.

For example, Active Directory had to deal with a peculiar issue as documented in KB2853952. Before the KB2855336 update rollup for WS2012, the IDE controller of a virtual machine running on WS2012 Hyper-V incorrectly reported that IDE controller write caching was disabled. This could lead to corruption issues if you installed a virtual domain controller on a VM on WS2012 and used the default AD database paths on the C: drive. Best practice was to store the AD databases on a D: drive that was attached to a SCSI controller (Microsoft Azure still requires this). The KB2855336 update rollup for WS2012 corrected the behavior of the IDE controller so that storing the AD databases on the IDE controller (the default C: drive location) would trigger write-through and prevent database corruption.

Related Topics:

BECOME A PETRI MEMBER:

Don't have a login but want to join the conversation? Sign up for a Petri Account

Register
Comments (2)

2 responses to “Hyper-V Virtual Machine Storage Controllers Explained”

  1. Andreas Erson

    Looks like there is some text missing under the Best Practices bullet point under the Gen 2 VMs chapter
  2. joshua.onx

    Hello Aidan. You seem to know your stuff! I've always found your information most helpful. I actually have a question regarding Server 2016 Hyper-V and pass-through disks.


    I have a hyper-v installed on a server with 2016 Datacenter. On it I have a VM running 2016 Datacenter. I set this up 1 year and 4 months ago. We put 4 disks into the server. I cleaned them and put them offline using diskpart. I then proceeded to attach them to the VM. The purpose of the VM is it's running Storage Spaces Direct with another VM on another hypervisor set up the same as this one. (Worst mistake ever was putting a 2 Node S2D cluster into production, but the company didn't want to spend the money for a 3rd server)


    The other day while applying some patches on everything on the one hypervisor etc. I took the following steps:

    1) I drained the Node/VM of all it's roles

    2) I shut down the VM

    3) Applied updates on the hypervisor and restarted


    When the hypervisor came back up the VM would not start. It didn't have permissions on the disk. Viewing the disks on the hypervisor with get-physicaldisk indicated the disks were now GPT instead of Raw.


    First I removed them from the VM settings, then prepped them with diskpart again. Reattached them to the VM, the VM started. Hooray! I thought. S2D saw them. I used reset-physicaldisk on them as there was the operational-status of transient error. Hours later, the error was still there. Not good. I was told we need it working now! Not wanting to bring everything back up non-redundant I made a decision. Everything is backed up. It's not hard to clear out the virtual-disks, the storage-pool, disable S2D, re-enable it and set everything back up. So I did, and restored the data from the backup I'd made before starting the process.


    So my question... What could I have done wrong with my setup, or my process that caused the disks to somehow be initialized when restarting the hypervisor, causing the VM not to start?

Leave a Reply

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.

Register for the Hybrid Identity Protection (HIP) Europe Conference!

Hybrid Identity Protection (HIP) Europe 2021 - Virtual Conference

Mobile workforces, cloud applications, and digitalization are changing every aspect of the modern enterprise. And with radical transformation come new business risks. Hybrid Identity Protection (HIP) is the premier educational forum for identity-centric practitioners. At the inaugural HIP Europe, join your local IAM experts and Microsoft MVPs to learn all the latest from the Hybrid Identity world.