Configuring Pass-through Disks in Hyper-V
A question the CORE Team gets asked frequently deals with configuring Hyper-V Guest with Pass-through disks. In this blog I will cover this topic.
Pass -through Disk Configuration
Hyper-V allows virtual machines to access storage mapped directly to the Hyper-V server without requiring the volume be configured. The storage can either be a physical disk internal to the Hyper-V server or it can be a Storage Area Network (SAN) Logical Unit (LUN) mapped to the Hyper-V server. To ensure the Guest has exclusive access to the storage, it must be placed in an Offline state from the Hyper-V server perspective. Additionally, this raw piece of storage is not limited in size so, hypothetically, it can be a multi-terabyte LUN.
After storage is mapped to the Hyper-V server, it will appear as a raw volume and will be in an Offline state (depending on the SAN Policy (Figure 1-1)) as seen in Figure 1.
Figure 1: Raw disk is Offline
Figure 1-1 SAN Mode determination using diskpart.exe
I stated earlier that a disk must be Offline from the Hyper-V servers' perspective in order for the Guest to have exclusive access. However, a raw volume must first be initialized before it can be used. To accomplish this in the Disk Management interface, the disk must first be brought Online. Once Online, the disk will show as being Not Initialized (Figure 2).
Figure 2: Disk is Online but Not Initialized
Right-click on the disk and select Initialize Disk (Figure 3).
Figure 3: Initialize the disk
Select either an MBR or GPT partition type (Figure 4).
Figure 4: Selecting a partition type
Once a disk is initialized, it can once again be placed in an Offline state. If the disk is not in an Offline state, it will not be available for selection when configuring the Guest's storage.
In order to configure a Pass-through disk in a Guest, you must select Attach a virtual disk later in the New Virtual Machine Wizard (Figure 5).
Figure 5: Choosing to attach a virtual disk later
If the Pass-through disk will be used to boot the operating system, it must be attached to an IDE Controller. Data disks can take advantage of SCSI controllers. In Figure 6, a Pass-through disk is attached to IDE Controller 0.
Figure 6: Attaching a pass-through disk to an IDE Controller
Note: If the disk does not appear in the drop down list, ensure the disk is Offline in the Disk Management interface (In Server CORE, use the diskpart.exe CLI).
Once the Pass-through disk is configured, the Guest can be started and data can placed on the drive. If an operating system will be installed, the installation process will properly prepare the disk. If the disk will be used for data storage, it must be prepared in the Guest operating system before data can be placed on it.
If a Pass-through disk, being used to support an operating system installation, is brought Online before the Guest is started, the Guest will fail to start. When using Pass-through disks to support an operating system installation, provisions must be made for storing the Guest configuration file in an alternate location. This is because the entire Pass-through disk is consumed by the operating system installation. An example would be to locate the configuration file on another internal drive in the Hyper-V server itself. Or, if it is a cluster, the configuration file can be hosted on a separate cluster providing highly available file services. Be aware that Pass-through disks cannot be dynamically expanded. Additionally, when using Pass-through disks, you lose the capability to take snapshots, and finally, you cannot use differencing disks with Pass-through disks.
Note: When using Pass-through disks in a Windows Server 2008 Failover Cluster, you must have the update documented in KB951308: Increased functionality and virtual machine control in the Windows Server 2008 Failover Cluster Management console for the Hyper-V role installed on all nodes in the cluster.
This completes our discussion. I hope you will find this information useful and share it with your colleagues.
Chuck Timon
Senior Support Escalation Engineer
Microsoft Enterprise Platforms Support
Comments
- Anonymous
January 01, 2003
Hi..I am trying to add the pass thru disks to highly available VM. I made sure the disk is offline in thehost, but added the disk in failover cluster manager and moved to required VM.But when I booted the VM after attaching the pass thru disk of 30 GB, found the VM boot up is very slow and VM overall functionality was dead.I am running Windows 2008 Ent. Edition with SP2. so the KB mentioned above does not apply.After that I removed the pass thru disk from Cluster and kept it offline on host machine. The VM performance was completely different. The machine booted fasted.. the disk access was also faster.Now if I have to move the VM from one node to other wondering if this configuration will allow me to move the disk configured along with passthru disk configured on the VM?Please update.. as we are looking to do it for our production environment.Amit - Anonymous
January 01, 2003
i wonder if you could answer several question i have regarding lun passthrouh.will performance increase if i install a guest os on a lan passthrough volume and boot from it(compare to if i enable the volume on the host and share it as VHD)?I've read that with lan passthrough approach, some VHD features are not usable such as snapshot. i'm planning to use DPM2007 to backup my virtual server. I know that dpm2007 can backup virtual server from the host(no agent is needed on guest os). if i'm using lun passthrough approach, does this mean dpm2007 won't be able to backup my virtual server from the host?in virtual server 2005, i read that performance will increase if i attached a virtual scsi disk, instead of IDE(physical scsi disk would help of course). does this also apply in hyper-v? or it doesn't really matter if i'm using physical scsi/sas hard drives?thanks so much for the blog entry - Anonymous
January 01, 2003
Hi Rajnish, i have this problem right now with a brand new 2TB usb plugged into a windows server 2008r2 vm via passthrough on a server 2012r2 hyper-v host - did you ever resolve the IO error? it allowed me to create a windows server backup routing using the disk without error but an actual backup when you run it fails and gives IO errors as you describe
cheers
ashley - Anonymous
January 01, 2003
thanks - Anonymous
January 01, 2003
Jaap en ik hebben al een keer gepost over pass-through disks in Hyper-V. Chuck Timon. Senior Support - Anonymous
July 01, 2010
If you have multiple pass thru disks, you can make mistakes of assigning the same disk to more than 1 VM. It would be nice if a pass-thru disk that is already assignd to one VM should not appear as available disk when you're selecting a pass-thru disk for other VMs. perhaps hyper-v development team might consider looking into it. - Anonymous
September 02, 2010
I am sitting on course The Implementing and Managing Windows Server 2008 HYper-V Course 6422A and the instructor is saying that only iSCSI storage is supported with pass-through disks , is this right as I thought it was any type of disk that the Hyper-V server sees as direct attached? - Anonymous
October 15, 2010
The comment has been removed - Anonymous
October 17, 2010
Most of the examples I've seen is configuring a pass through disks with an empty physical drive, my question is can I conect a physical drive that has data through a pass through disks? The reason for doing this is to transfer the files from the physical drive to vhd. - Anonymous
December 03, 2010
Glenn, yes, really you can transfer data this way. Not sure it's right way, but it works. - Anonymous
October 17, 2011
What if we want to present a disk to the VM, the disk which has already been presented to the Host machine through a SAN management system.Does that disk still need to be offline on the Host machine?We want to use that disk to store data inside the VM. - Anonymous
January 13, 2012
Thanks for post. We are using pass-through disks quite a lot, but have had some issues with VMs mixing up the attached discs after reboot of the host. The luns/disks randomly change disk numbers in disk management after some reboots. As a result the VM's might have the wrong pass-through disk attached creating abvious problems using it even causing data corruption. We just attach a iscsi lun to the host, then take it offline (no initialization/online first). Then we attached it to a VM. It works fine, but sometimes we get the problem above after hyper-v svr reboot. Is the reason that we MUST make the disk online and initialize it before taking it offline and attach it to a VM as a pass-through disk? - Anonymous
August 01, 2012
i have mapped one lun each to windows and linux virtual machines from windows8 hyper-v server and i am able to see the lun on windows VM but it is not detected in rhel VM.please let me know the issue. - Anonymous
January 16, 2013
The comment has been removed - Anonymous
April 04, 2013
Hi Chuck,I have server (VM) having pass-through disk attached, this particular disk is giving error while accessing it "The operation can not be performed due to I/O device error.can you help me in this to fix it.Regardsrajnish - Anonymous
October 04, 2014
Great explanation thank you ! - Anonymous
March 10, 2015
Have practically understood configuring Pass-thruogh Disks in Hyper-V. - Anonymous
April 01, 2015
The comment has been removed - Anonymous
January 16, 2016
can we create a pass-through disk to dynamic disk - Anonymous
March 14, 2016
Hello,I have a Hyper-V 2008 R2 environment. I have a VM that has a pass-through disk that i use for data that is attached the way you describe above, except that the pass through disk is attached through IDE and not SCSI controller in Hyper-V.My question is how can I properly expand (increase) disk space?My theory.1. Shutdown the VM.2. Expand the LUN on the SAN.3.Fire up the VM.4.Expand the Disk in Disk Management in the VM.Would that work?Thank you - Anonymous
March 21, 2017
Hi, I met a problem, could you please help to take a look?I run a VM with Windows Server 2012 and hyper-v, with a passthrough disk. But recently, the host OS was dead occasionally. I found troubleshooting and fixing the problem, I found that the passthroughed disk was brought to online. Then I made it offline. But I could not never start the VM reporting the disk file missing, and I could never select the passthroughed disk when configuring VM, although the disk was in offline state. Any ideas to fix this? Thanks a lot.Jano