Proxmox Physical Disk to VM – Only 2 Commands!

VMs are great, they allow you to consolidate many computers in to 1 physical system without forcing you to use a single OS. Sometimes it’s nice to give these VMs access to HW directly. In this guide I’ll show you how to pass a disk, at the block level through to a VM in Proxmox. This isn’t passing the disk through directly so it’s not a good idea to use ZFS or raid on the passed through disks. You’ll notice they still show as a VirtIO device inside the VM.

My personal use case is storage my home security camera footage on a hard drive. I didn’t want to make a single large virtual hard drive, I wanted the VM to use the whole disk for the footage. Proxmox is what I run on my 24×7 VM host, therefor I’ll be using it in this guide.

 


Finding the Disk in the Proxmox Terminal

I presume you already have a VM ready and a disk in the system that you want to pass through.

The first step is so find the ID of the disk you want to pass through. While you can use /dev/sdX, you don’t want to as this can change as you add, remove or rearrange disks. Here are the steps for finding the ID You’ll need to either login by SSH or go to the Proxmox terminal directly.

Type in ls /dev/disk/by-id/

root@pve:~# ls /dev/disk/by-id/
ata-Samsung_SSD_860_EVO_250GB_S3Y9NX0M509446L
ata-Samsung_SSD_860_EVO_250GB_S3Y9NX0M509446L-part1
ata-Samsung_SSD_860_EVO_250GB_S3Y9NX0M509446L-part2
ata-Samsung_SSD_860_EVO_250GB_S3Y9NX0M509446L-part3
ata-WDC_WD20EARX-00ZUDB0_WD-WMC1H0037415
ata-WDC_WD20EARX-00ZUDB0_WD-WMC1H0037415-part1
ata-WDC_WD20EARX-00ZUDB0_WD-WMC1H0037415-part2
---truncated---

The lines ending with part1, part2 etc are the partitions on each disk. We aren’t interested in these as we want the whole disk regardless of partitions. The line I’ll want to pass my WD 2TB drive is ‘ata-WDC_WD20EARX-00ZUDB0_WD-WMC1H0037415‘ however this will be unique for every HDD/SSD.

Once you have identified the disk you’re interested in there is only 1 more line to type! But first lets identify the ID of the VM you want to attach this disk to. Open the Proxmox WebGUI and look at the VM list.

Remember the number of the VM you want to attach to. We need to make a command to pass the disk through now. It goes as follows:

qm set VM-ID -virtio2 /dev/disk/by-id/DISK-ID

replace VM-ID with the number of the VM and DISK-ID with the disk ID. In my case I will end up with ‘qm set 100 -virtio2 /dev/disk/by-id/ata-WDC_WD20EARX-00ZUDB0_WD-WMC1H0037415‘.

After doing this you should be able to see the disk in the Hardware tab for your VM.

Now, if your OS already knows about VirtIO then you’re done! If not keep reading… I’ll explain how to install the driver.

VirtIO Driver in Windows

Installing the VirtIO driver is quite simple. They don’t give you an installer program so I’ll guide you through the manual install process below.

  1. You’ll want to go to this link and download the VirtIO ISO. Scroll down to Direct downloads and select Stable virtio-win iso.
  2. Upload this ISO to Proxmox ISO Storage and mount it in your Windows VM’s CD drive.
  3. Boot the VM and open device manager.
  4. Right click the new HDD and select Update Driver Software….
  5. Select Browse my computer for driver software.
  6. Click browse then browse to the viostor folder inside the cd.
  7. Pick your OS and 64/32 bit folder then go next. It should install the driver and your disk should be working. Now you can make your partition in disk management like normal.

All done! Congratulations.

If you’ve found this guide helpful please drop a comment below or share it on one of the social media links.

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email

Leave a comment

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