How to attach physical disk to VM inside Hyper-V

There are times when you have to add physical disk directly to the VM (like Storage Spaces Direct for example). You can do that inside Hyper-V, assuming you don’t have RAID controller in the way. In this short guide, I will show you how to add physical disk to the VM inside Hyper-V on Windows Server 2019.

Before we begin

This probably will not work if you have RAID controller in charge of your disks. You need HBA or SATA/NVMe directly from your motherboard (without RAID settings)

Also, in my experience USB drives will also now work with this.

If you have some data on the disk you wish to attach/detach to VM, make sure you have valid backups before you proceed.

Prerequisites

Installed Hyper-V, available hard drive in offline state, and a VM to add disk to.

Disks you wish to add need to be in offline state

Control Panel | Administrative Tools | Computer Management | select Disk Management | disk you wish to add should be Offline.

Add disk to VM inside Hyper-V

Open Hyper-V Manager, shut down VM you wish to add disk to (it is the safest way) and select Settings of the VM

Select SCSI Controller | click on Hard Drive | select Add

New Hard Drive will appear under SCSI Controller, select it, and select Physical hard disk

Although I have two unformatted and offline physical drives. Apply

You can now see that the third drive is Physical drive for my VM.

Ok.

After you turn on VM, again go to Control Panel… Disk Management inside VM. You can see that disk is added. Now VM sees Samsung SSD 960 as a drive on it.

In case you have multiple physical drives that you want to add to your VM and you are not able to add them under current SCSI Controller, create a new SCSI Controller and add hard drives under new SCSI Controller.

Remove physical hard drive from VM in Hyper-V

Turn off VM to which the drive is attached (make sure you backed up data in case you have something you will need), go to the Hyper-V Manager and settings of the VM, select Physical hard drive under SCSI controller and select – Remove. Apply | OK

That should be it, you now know how to add-remove physical drive to your Hyper-V VM.

Disclaimer