Passthrough Physical Disk to Proxmox VMs

Written in

by

Last updated on

Locating the Disk and preparing for Passthrough

Under the Disks tab, look for the target Disk you’d like to pass over to your VM. Once you’ve located it, take note of the Serial Number of it.

Optional step;
Hit Wipe Disk.

Optional step;
This will delete all contents of the Disk and wipe it completely, so make sure you don’t have anything important left on it!
Hit Yes, and let it do it’s job.

Type this into the terminal;

find /dev/disk/by-id/ -type l|xargs -I{} ls -l {}|grep -v -E '[0-9]$' |sort -k11|cut -d' ' -f9,10,11,12

It will then show you the complete path of the disk you want.
Copy the path like this and keep it;

/dev/disk/by-id/{disk-serial}

Head into the Hardware tab of the VM you’re going to give the Disk to, and have a look at the current Disk type, in this case it’s scsi0.

Go back into the Shell again, and type;

qm set {vmid} -{disk-type}{number} /dev/disk/by-id/{disk-serial}

If done correctly, it’ll post a similar output as shown. If not, double check the previous steps.

For Windows and Linux, you’d want; scsi.
For macOS, you’d want; virtio.

Head back into the Hardware tab of your VM again, and see if it’s been listed correctly as shown.

Hit Edit once selected.

This is the setting you want to have set for your Disk, in this example this is for Windows. Other OS’s will differ.

For Windows and Linux; as shown.
For macOS; Write back (unsafe).


Once set, boot up your VM.

Configuring Disk inside Windows

When Windows has booted, open up Disk Management, and this is what you’ll be greeted with.

Hit OK and follow the next steps.

Once you’ve set your desired size, size and drive letter, hit Finish.

Congratulations on your successful Disk Passthrough!

Unlinking a Disk from a VM

Should you want to remove a Disk from a VM after adding it, type the following in the Shell;

qm unlink {vmid} --idlist {disk-type}{number}

{disk-type}{number} e.g. scsi1