Mounting a physical disk or external disk to a VM in Hyper-V

I think that mounting a physical disk or external disk to a VM in Hyper-V is really interesting, especially if you’re looking to attach a USB stick or an external HDD to a virtual machine.
The operation is very simple but I suggest you not to abuse it: mounting a disk through a USB port will result in getting a pretty slow data transfer, but at the same time it’ll result in instant data-portability.

So, in order to do that we just need to mark the disk as inactive. Open a command prompt and type the following.

Now note the disk number you want to attach to the virtual machine, let’s say it’s number 3.
Run this.

You may now exist disk part and go in Hyper-V and attach a new disk to the virtual machine. In the screenshot below I attached it as an iSCSI controller.

attachexternaldisktohyper-vVM

The reason why I mounted a USB disk (once) was due a disaster occurred on one of the hypervisors where the File Server (VM) was running on.
So, once we were able to get all the data on the external disk, we plugged it into another hypervisor (Hyper-V on Windows Server 2012 R2) and started moving the data across to the new VM. It was taking ages and I needed this data available even if it would have been really slow for a day or so until I could get a larger maintenance window.
Attaching the disk to a virtual machine that way meant having production to keep running and almost nobody complained of the speed! Obviously you could just attach a physical disk connected to the Hyper-V host in order to dedicate it to the virtual machine.

2 thoughts on “Mounting a physical disk or external disk to a VM in Hyper-V

  1. Hi,
    Do you think, the transfer speed will increase, if i create a virtual disk for my external USB 3 HDD (3TB)?
    Currently the tansfer speed is around 15MB/s, with the disk attached as a phisical device.

    Thanks!

    1. Hi, how are you getting 15MBps at the minute? Are you accessing the USB device as a share from the VM? If that’s the case, 15MBps seems an odd number. If the host shares the same NIC, then you should be achieving (virtually) 10Gbps, so you should be limited by the USB3.0 protocol (minus some noise). If your host doesn’t share the network adapater with the vswitch, then the NICs must be connected at least to a 1Gbps switch, which in theory should give you ~120MBps, so again, limited by that/USB3.0. If you were on a 100Mbps, you wouldn’t reach 15MBps. A questions is: do you have the same speed whilst transferring from the external HDD to your hypervisor? And does the hypervisor support USB3.0 or even 2.0?

Leave a Reply

Your email address will not be published. Required fields are marked *