How to do a SCSI passthrough

highbiker

New Member
Jun 28, 2022
4
4
3
Hi,

In Unraid, SCSI passthrough for an internal BluRay drive is possible (see https://forum.proxmox.com/threads/bluray-guest-os-support.45930).

I have tested this myself. My drive is passed to my VM (Windows10) with its correct SERIAL_ID and works without problems even with programmes like MakeMKV.

Unfortunately, in Proxmox I have not found a way to pass through my drive in that way.
By using "use physical cd/dvd drive" I'm getting a QEMU-Device in my VM, which can not be handled by MakeMKV. Also setting the serial_id (serial=...) in my vmID.conf is not working. Drive is still named as QEMU-Device.

The post https://forum.proxmox.com/threads/bluray-guest-os-support.45930 indicates that SCSI-Passthrough might not be a big deal and may be possible in PVE.

Does anybody know how to do a SCSI Passthrough in PVE, which is as capable as in unraid?
 
Please let us know if you get it to work. I only know of other ways to get a optical drive to do more than read simple file bases disc.
I assume you'll need to configure a block device mapped to your physical device and add it to the VirtIO SCSI controller, via the args-line in the VM configuration file.
 
I reinstalled Unraid and configured my VM to passthrough the Blu-Ray drive. In the QEMU-Logs (/var/log/libvirt/qemu/$vmname.log) I got the qemu args which are used to start the VM. Here is the subset which should be relevant for my drive (/dev/sg6)

Code:
-device virtio-scsi-pci,id=scsi0,bus=pci.9,addr=0x0 \
-drive file=/dev/sg6,if=none,format=raw,id=drive-hostdev0,readonly=on \
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-hostdev0,id=hostdev0 \

Unraid seems to use a scsi-generic instead of a scsi-block device.

Tomorrow I will switch back to Proxmox and try out.
 
  • Like
Reactions: leesteken
Hi, sorry for my late reply, but I had less time then expected.

I have good news: It's working!!
This is my current config and I think, only the args line is important:
Code:
args: -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x1 -drive file=/dev/sg1,if=none,format=raw,id=drive-hostdev0,readonly=on -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-hostdev0,id=hostdev0
bios: ovmf
boot: order=sata0;net0
cores: 12
cpu: host
efidisk0: local-lvm:vm-102-disk-0,efitype=4m,pre-enrolled-keys=1,size=4M
machine: pc-q35-6.2
memory: 4096
meta: creation-qemu=6.2.0,ctime=1657471651
name: Windows10
net0: e1000=2A:22:57:70:1B:18,bridge=vmbr0,firewall=1
numa: 0
ostype: win10
sata0: local-lvm:vm-102-disk-1,cache=writethrough,size=128G
scsihw: virtio-scsi-pci
smbios1: uuid=550bee02-79dc-46b6-9b2d-5fbe1ef6afb6
sockets: 1
vmgenid: 6f2b03a4-ee4e-4183-989d-7896b5fb85a5

I found my "/dev/sg*" by
Bash:
ls -l /dev | grep sg | grep cdrom

Maybe you have to play arround with bus=pci.0,addr=0x or bus=scsi0.0,channel=0,scsi-id=0,lun=0.

After adding the args line to the config, the guest reports an unkown pci device. You can install the required driver from the virtio-win iso (I used: virtio-win-0.1.217.iso). The guest will report a "Red Hat VirtIO SCSI pass-through controller" after installing the driver. Since then, my guest finds my BD-Drive with its correct name (ASUS BW-16D1HT SCSI CdRom Device).

Both makemkv and burning work, but it is not as reliable as on a native system:
  1. For burning you need admin rights (windows 10 guest)
  2. Sometimes the drive is not working properly, when I start my VM and a disk is in the tray. Then, I have to open and close the tray or restart the VM.
  3. The first use of MakeMKV fails. After reopening MakeMKV, it works.
Despite these issues, it's good enough for my purposes.
 
  • Like
Reactions: ChrisTo and Dunuin

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!