Problems with KVM/QEMU passthrough DVD writer

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Glidos

New Member
Jun 19, 2024
3
0
1
I've recently changed my server to run as a VM using KVM/QEMU via virt-manager. All has generally gone well, but I now want to make use of the machine's DVD writer from the VM. I've tried passing it through in the same way as I've passed through hard disks (but selecting CDROM and SCSI). That works to some degree, in that I can read data DVDs from the VM, but I cannot write. I've been using k3b. It claims it can't find a writer device on start up, although it lists the device under settings, along with all the device's capabilities, so it is seeing it. I suspect the problem is that virt-manager has the device marked as readonly. I've tried to remove that setting, without success. virt-manager wont permit the check box to be unchecked. I've tried removing the <readonly/> line from the XML, but it gets reenstated automatically. I've also tried changing it to <readonly>false</readonly>, but that runs into XML validation errors.

Has anyone else run into similar and found a solution? The machine does have two SATA controllers. I could passthrough one at the PCI level if I have to, but I'd rather not do that if I can avoid it.
 

CyklonDX

Well-Known Member
Nov 8, 2022
1,639
584
113
see if this works for you

(there are more posts further down)
 

Glidos

New Member
Jun 19, 2024
3
0
1
Thank you. That seems to have worked. I say "seems" because I get errors when reading back the DVDs that I write, but it's a very old drive that hasn't been used for years. The passthrough part, I believe, is now working.

Strangely, I didn't seem to need the first line in their solutions. In my case, lsscsi gave HCTL as [0:0:1:0], so I added

Code:
<hostdev mode="subsystem" type="scsi" managed="no">
  <source>
    <adapter name="scsi_host0"/>
    <address bus="0" target="1" unit="0"/>
  </source>
  <alias name="hostdev0"/>
  <address type="drive" controller="0" bus="0" target="0" unit="0"/>
</hostdev>
to the VM's XML.
 

Glidos

New Member
Jun 19, 2024
3
0
1
I have it working now and will describe how, just in case it proves useful to someone else. I couldn't get any of the suggestions from that forums.unraid.net post to work. Some of the suggestions work readonly, but not for writing. Possibly there's a missing step for disconnecting the writer from the host, but I'm just guessing.

Given the lack of success in passing the device, I went back to pcie pass through of a sata controller. I realised that that was a better solution for me in any case: I have a hard disc and writer that need to be passed through - I need to move them both between different VMs at times, but always together - hence it is a good solution to plug both into the same sata controller, and pass through that controller. I also read that pcie pass through is a very efficient method, giving the fastest of data-transfer speeds.

The initial attempt at controller pass through didn't go well. The motherboard has a 4-way and a 2-way sata controller built in. The obvious strategy was to pass through the 2 way. I tried that, but hadn't reallised that both the 4-way and 2-way were in the same iommu group. That meant that an attempt to pass through one, passes through both (and the network card, as it happens). I was surprised how the host managed to limp on as its root disc and network card disappeared while starting the VM. :)

So next attempt was to buy a sata controller card (an IO Crest 4 Port SATA III PCI-e 3.0 x1 Card with an ASMedia 1064 chip. Even that wasn't plain sailing. The motherboard had mostly old PCI-e 2.0 sockets. The only spare 3.0 socket was one of the two x16 sockets, so I have the x1 card plugged into an x16 socket.

After all that, I now have a completely reliable disc and a completely reliable CD/DVD writer accessible to the VM.

Thanks for help in getting here.