Passing a Physical Drive through to a VM in ProxMox

ieronymous

Active Member
Apr 1, 2019
251
18
38
44
I will be as quick as possible, since the question tends to be specific to one option of the command. As the titles states, in an effort to pass through a usb-hdd to a VM I did the following from cli
First identified the usb disk Id with
ls -n /dev/disk/by-id/
Afterwards, passed that disk to the VM (Vm shut down) with the command
qm set [VM-ID] -virtio2 /dev/disk/by-id/[DISK-ID]
Even though, after started the VM noticed the disk in disk management only, had the probably well known problem of the disk being offline
<<Disk Is Offline Because of Policy Set by an Administrator>>. There are 3 ways to fix this with the first way being simple the simplest of the all
(ok left click and make it online) nothing seemed to work and each action stuck/froze the VM. I couldn't shut it down (only with cli qm stop and it took 5 mins to give the termsig signal) and I couldn t start it up as well (stuck at loading). When I was detaching the disk in 5 sec WinServ was at the login screen.
I decided to pass the disk with -scsi1 option instead of -virtio1 and the results were the same. Froze Vm at each action.
As a last attempt, I passed the disk with the option -sata1 like
qm set [VM-ID] -sata /dev/disk/by-id/[DISK-ID]
Well it worked like a charm. Booted, seen the disk, assigned it a letter all automatically and I could continue with my work.

So my question is...... what physical characteristic of the disk is that, that has an impact of the option someone has to use in order to pass it ot a VM?
Are sata drives meant to be used with -sata only option (for qm set)? Do sas drives play with both -iscsi and -virtio option? Was my problem irrelevant to all of the above and a sata disk could be passed with all the options? (sata/iscsi/virtio)?

PS I know that this has to do with the driver that the user dictates the VM to see the disk, so I tent to believe the type of disk to be passed is irrelevant to the option used but I want to be sure. Any thoughts?
 
My understanding with this is that with a VM disk, the emulation layer translates the disk i/o from whatever hardware the vm 'thinks' is in use (SCSI/Virtio/etc) to the corresponding commands for the physical device. With hdd-passthrough, the emulation layer just passes the commands from the VM to the HDD untranslated, therefore passing a SATA drive through as SCSI will not work as the command structures are different. Equally with a Virtio device which has no corresponding device type in the physical space.
 
My understanding with this is that with a VM disk, the emulation layer translates the disk i/o from whatever hardware the vm 'thinks' is in use (SCSI/Virtio/etc) to the corresponding commands for the physical device. With hdd-passthrough, the emulation layer just passes the commands from the VM to the HDD untranslated, therefore passing a SATA drive through as SCSI will not work as the command structures are different. Equally with a Virtio device which has no corresponding device type in the physical space.
... sounds reasonable. Don t know if that is the case though. Not an expert
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!