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).
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).
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.