- Published on : 12 October 2019 at 12:01 UTC
If you often use virtualization, you should have noticed that you often lose performance (compared to a physical machine).
These performance losses occur mainly at the input / output level for the network and storage.
If you want to virtualize systems that need a lot of input / output at the storage level (such as database servers : Microsoft SQL Server or MySQL), it might be interesting to create a virtual machine that will directly use a hard disk physical rather than using a virtual hard drive.
Thus, the operating system and programs will be virtualized, but the data will be stored directly on the physical hard drive and not in a VHD or VHDX file.
- Create a virtual machine
- Attach a physical hard disk to a virtual machine
- Installing the guest operating system
To get started, create a new virtual machine.
At the "Connect Virtual Hard Disk" step, select the option : Attach a virtual hard disk later.
As you can see, this virtual machine will not use any hard drives for the moment.
To attach a physical hard disk to a virtual machine, you must first detach it from the host system (the Hyper-V server).
For this, in the server manager, go to : Tools -> Computer Management.
Right-click on the hard drive to use from your virtual machine and click : Offline.
Now, this hard drive is "Offline".
This hard drive has disappeared from the file explorer.
In the Hyper-V Manager, select the virtual machine that you created earlier and click "Setting".
In the settings of this virtual machine :
- select the IDE controller 0
- select : Hard Drive
- click : Add
Select "Physical hard disk" and select your physical hard disk.
Note : if the physical hard disk to use doesn't appear in the list, it means that this physical hard disk is not "Offline" on your Hyper-V server.
Since we didn't create a virtual hard disk while creating the virtual machine, the wizard stopped earlier than expected and didn't offer to select the CD/DVD to use to install the guest operating system.
To solve this little problem :
- select the DVD Drive
- select : Image file
- click : Browse
- select the iso file of the operating system to install in this virtual machine
Click OK to save the changes.
Now, you can use this virtual machine as a classic computer.
The virtual machine starts and arrives, as expected, on the Windows installation.
As expected, the virtual machine recognizes the partitions of our physical hard disk.
If needed, delete the partition(s) of the physical hard disk.
To do this, select the partitions one by one, and then click : Drive options (advanced) -> Delete.
Partition the hard disk if you want, and then click Next to install Windows into the virtual machine.
Once under Windows, you will see that the physical hard drive will be recognized as a real hard drive in the guest system.
Except that the performance at the storage level will be much better.