Attaching Physical Hard Disks to Hyper-V VMs

Attaching Physical Hard Disks to Hyper-V VMs

  • Comments 19

Hyper-V brings us the ability to attach a physical hard disk directly to a virtual machine.  In order to do this the hard disk in question needs to not be identified as "removable" by Windows.  It also needs to be in an offline state.  This can be configured by using the Disk Management node of the Windows Server 2008 Server Manager, right clicking on the disk in question, and selecting Offline:

passthrough2

Once you have done this you can open the settings for the virtual machine in question, adding a new hard disk, and selecting to use a physical hard disk.

passthrough

Note that once you have a physical hard disk attached to a virtual machine, it is not possible to take snapshots of the virtual machine.

Cheers,
Ben

Leave a Comment
  • Please add 5 and 3 and type the answer here:
  • Post
  • 'the hard disk in question needs to not be identified as "removable" by Windows'

    What is the purpose of that requirement?

    'It also needs to be in an offline state'

    That makes sense.  When I needed to do this in XP, I couldn't find a way to make the disk offline, so the closest thing I could do was delete the drive letters from the partitions.  Then VPC 2004 allowed a guest full access.  I read that VPC 2007 refuses full access in the same situation, for an asserted reason which falls a bit short.

    But really, why prohibit the user from doing this with a drive that's removable in reality?  Why tell a developer "no you can't do risky experiments on disposable materials, you have to do your risky experiments on the production stuff you have internal to your real computer".  Sheesh.

  • Can you reassign the VM boot order and boot from this drive?

  • Hi Ben,

    You say: Note that once you have a physical hard disk attached to a virtual machine, it is not possible to take snapshots of the virtual machine.

    Can you tell us more about that? Do i understand correctly that if you have a VM (which runs in a VHD) and you attach one or more physical HD to it you will loose the ability to take snapshots of the VHD?

  • Norman -

    Note that most flash / usb devices can be configured to not be removable from Windows point of view.  This only explicitly blocks things with actual removable media (socketted flash readers).  For this screen shot I was using a USB disk.

    Wesley -

    Yes, you can.

    Kenneth -

    If you have a virtual machine with a physical hard disk attached - attempts to take snapshots will fail immediately (even if you have VHDs attached) because we cannot make a differencing disk for the physical disk.

    Cheers,

    Ben

  • Hi Ben,

    Thanks for your response !

    So when using snapshot technology in Hyper-V you take a snapshot of the whole machine (including every disk attached to it), and it isn't possible to just take a snapshot of only the OS Disk?

    Did i understand that correctly?

  • "For this screen shot I was using a USB disk."

    OK, great, thank you, but still...

    "Note that most flash / usb devices can be configured to not be removable from Windows point of view.  This only explicitly blocks things with actual removable media (socketted flash readers)."

    I still wonder what the purpose is, since a project that I'm working on now is supposed to target every recognizable kind of storage device and I really like the ability to test things like this in virtual machines.

    Even if there's a way to tell Windows (the physical host here) to configure a device with really removable media to pretend that the device has non-removable media, I still wonder what the purpose is.  Of course after finishing a test in the virtual guest and shutting down the guest, the developer might want to revert the configuration in the physical host and remove the media.

  • How is with performance physical disk vs. virtual are there any speed boost when using physical drive?

    And congratulations to whole Team-V ;-), I’m testing Hyper-V quite for a long time and it works really nice!

  • "How is with performance physical disk vs. virtual are there any speed boost when using physical drive?"

    The physical host doesn't access any files on the same drive so all of the disk arm movements belong to the guest.

  • How do I  configure flash / usb devices to not be removable from Windows point of view?

  • Hi Ben,

    Is it possible to Attaching flash / USB Disks to Hyper-V VMs?

  • Do you know how to use Add-VMDisk to add the Physical hard disk (pass through) to drive?

  • Hi Ben & thanks for your guides,

    I tried to use a phyiscla disk, but instead of using logical partitions hyper-v is using the whole drive.

    Do you see another option?

    I'd just like to apply the disk as one partition. VMDK files offer exactly this option.

  • Ben:

    First, I thank you.  This writeup helped me get physical drives connected.

    Second, I am having an issue with physical drives on my VM.  I have a Windows Home Server VM on my host and determined that I would want to use physical drives for the data pool due to the drive management scheme that WHSv1 uses.  I got the first drive attached to the VM and was able to boot up and add it to the drive pool, but after shutting down to add another drive, the first drive was no longer accessible by the VM.  I was able to correct it by removing the drive from the pool and re-adding it, but that solution will not work once data is on the drives, as removing and re-adding will purge whatever data is on the affected drive.

    Is there anything you can recommend for this situation?

  • This is great.. Save my time... Thanks !

  • The Offline option is not present at all for the removeabel disk in the server manager.

Page 1 of 2 (19 items) 12