Passthrough optical drives


Recommended Posts

I read some confusion information on the forum:

  • There's a thread which says unRAID does not have optical drive drivers and thus will never support passing through
  • There's another thread which says it's possible using "by-id" (which I can see on my rig e.g lrwxrwxrwx 1 root root  9 Apr 22 21:40 ata-PIONEER_BD-RW_BDR-207D -> ../../sr0) but then it refers to XEN, not KVM, I think.
  • Someone also said the only way is to passthrough optical drive is the entire sata controller.

Confused.com  :-\

  • Like 1
Link to comment

I'm successfully passing through a BluRay drive to Win7/10 by adding the following to my XML

 

<hostdev mode='subsystem' type='scsi' managed='no'>
  <source>
    <adapter name='scsi_host7'/>
    <address bus='0' target='0' unit='0'/>
  </source>
  <readonly/>
  <address type='drive' controller='0' bus='0' target='0' unit='2'/>
</hostdev>

 

To pass though the following drive

 

[0:0:0:0]    disk    Lexar    JD FireFly       1100  /dev/sda 
...
[7:0:0:0]    cd/dvd  HL-DT-ST BD-RE  WH14NS40  1.03  /dev/sr0 

Link to comment

Did you try looking in device manager for unidentified devices/scanning for new devices? I had to manually direct it to the virtio SCSI driver before the disc drive showed up.

Windows says the scsi driver on the virtio disk is not designed for my drive. I tried to install it regardless and the errored scsi device went away but no drive. :(

Link to comment

OMG I got it to work!!!!!! And it looks like Windows actually detected it as a Bluray writer too (put a blank Bluray in and it asks if I want to use it like a USB :D)!!!!!

 

I put this in the xml right before the </devices> tag:

Note the index = 1 and controller = 1 amendment. :D

<controller type='scsi' index='1' model='virtio-scsi'/> 
<hostdev mode='subsystem' type='scsi'> 
   <source> 
     <adapter name='scsi_host9'/> 
     <address type='scsi' bus='0' target='0' unit='0'/> 
   </source> 
   <readonly/> 
   <address type='drive' controller='1' bus='0' target='0' unit='0'/> 
   </hostdev>

 

The start the VM (which crashes but it crashes randomly due to lack of memory - oh well, running it in VMWare Workstation) and then install virtio scsi driver (which shows up as passthrough) for the 2nd no-driver scsi item - which windows just install the drivers on the virtio disk, no need to force it.

 

Then voila!

 

When I checked the xml again, unRAID has automatically rearranged the codes and changed it a little:

    <controller type='scsi' index='1' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
...
    <hostdev mode='subsystem' type='scsi' managed='no'>
      <source>
        <adapter name='scsi_host9'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <readonly/>
      <address type='drive' controller='1' bus='0' target='0' unit='0'/>
    </hostdev>

 

*there should be an emoji for celebration*  ;D

  • Thanks 1
Link to comment
  • 1 year later...

I am trying to get this to work myself but a little confused. I am trying to pass through

 

[7:0:4:0]    cd/dvd  PIONEER  BD-RW   BDR-208M 1.10  /dev/sr0 

 

Would this be correct?

<hostdev mode='subsystem' type='scsi'> 
   <source> 
     <adapter name='scsi_host7'/> 
     <address type='scsi' bus='0' target='4' unit='0'/> 
   </source> 
   <readonly/> 
   <address type='drive' controller='1' bus='0' target='4' unit='0'/> 
   </hostdev>

 

Link to comment

It looks like it did work but I'm not sure what controller='1' means.

 

Also initially I had two SCSI Controllers without drivers in Device Manager, once took the virtio drivers while the other doesn't. Now I have the Blu-ray drive showing up in Windows but I am not sure why I have this extra SCSI controller showing up.

Link to comment
  • 6 months later...

Given how little discussion there is on passthrough drives, I figured it best to ask a related question here. I've mapped a BD drive to MakeMkV for ripping in discs, but a new thing has started happening. The drive automatically ejects when done ripping a disc as it always has, but now it automatically closes after a few minutes as well. Then it re-rips continually automatically opening and closing until I manually stop it. I could shut off automatic ejecting at MakeMKV, and just use the status light on the drive to tell quickly if it's done, but I like the eject to prompt a new disc insert. Any way you guys see of stopping automatic closing?

Link to comment
  • 1 year later...

Using the similar code as above, without the recommended changes, I was able to see one SCSI Controller in Windows but I couldn't add the Virtio driver for it.  After adding the controller code, removing managed='no' from <hostdev>, and adding address controller='1', I was able to see two SCSI Controllers in Windows and able to add the Virtio driver for one of them which allowed me to see the DVD drive!! :)

 

Removing managed='no' is probably unnecessary as it gets added back but not sure.  Also, I'd tried going directly to the code which gets created after updating but it wouldn't work because I put 2 and instead it uses hex which turned out to be slot='0x0a'.

 

Thanks for sharing!!

Edited by bugsysiegals
  • Like 1
Link to comment
  • 9 months later...
  • 5 months later...

Hi,

i got it working tnaks to your info here and clearing out some smoke thanks to this side: https://www.ibm.com/docs/en/linux-on-systems?topic=devices-scsi-tape-medium-changer

 

So i tape drive and changer is running with the following setup:

Info in unraid lsscsi:

[1:0:10:0]   tape    HP       Ultrium 5-SCSI   Z63U  /dev/st1 

Important is the first 1 this lead to scsi_host1

and the 10 which leads to the target 10 in the tape source section
[1:0:11:0]   mediumx TANDBERG StorageLoader    0495  -        

Important is the first 1 this lead to scsi_host1

and the 11 which leads to the target 11 in the Loader source section

 

With the following configs in the vm xml:

<!--tape drive -->

<hostdev mode='subsystem' type='scsi' managed='no'>
      <source>
        <adapter name='scsi_host1'/>
        <address bus='0' target='10' unit='0'/>
      </source>
      <address type='drive' controller='1' bus='0' target='1' unit='0'/>
    </hostdev>

<!-- Storage Loader -->
    <hostdev mode='subsystem' type='scsi' managed='no'>
      <source>
        <adapter name='scsi_host1'/>
        <address bus='0' target='11' unit='0'/>
      </source>
      <address type='drive' controller='1' bus='0' target='2' unit='0'/>
    </hostdev>

 

The drive controller was generated as scsi virto-controller with unraid  and looks for me as:

    <controller type='scsi' index='1' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
 

Hope this will help someone

 

Now the next big obstacle is the virtio-fs driver.......

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.