Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

how to add M.2 NVMe passthrough manually to VM's XML configuration

Featured Replies

I want to passthrough a couple of M.2 SSDs. I am able to do the passthrough with a simple Linux VM configuration using the UI (confirmed with testing). When I try to do the passthrough to another Linux VM though, one that has some manual modifications done to its XML configuration file, it messes up the XML configuration and VM won't boot. 

 

I've seen this Unraid bug before where if you switch back to UI mode and save after manually modifying VM's XML config it can mess it up. So I backed it up and was able to recover but I'm stuck as to how to add the passthrough for the m.2s manually to my xml file.

 

Solved by SimonF

  • Community Expert
2 hours ago, JKunraid said:

I want to passthrough a couple of M.2 SSDs. I am able to do the passthrough with a simple Linux VM configuration using the UI (confirmed with testing). When I try to do the passthrough to another Linux VM though, one that has some manual modifications done to its XML configuration file, it messes up the XML configuration and VM won't boot. 

 

I've seen this Unraid bug before where if you switch back to UI mode and save after manually modifying VM's XML config it can mess it up. So I backed it up and was able to recover but I'm stuck as to how to add the passthrough for the m.2s manually to my xml file.

 

You can manually add path /dev/disk/by-id/usb-SanDisk_Cruzer_Blade_x-00: to the drive in the GUI or bind the drive to vfio and then you can add as a PCI device in the template. 

image.png

 

 

  • Author
15 hours ago, SimonF said:

You can manually add path /dev/disk/by-id/usb-SanDisk_Cruzer_Blade_x-00: to the drive in the GUI or bind the drive to vfio and then you can add as a PCI device in the template. 

image.png

 

 

Thanks again for reply Simon. Not following you though.

 

I've already done the vfio bind in system devices and confirmed I can add the m.2 drives to another basic VM using Unraids VM template GUI. That VM boots fine and adds the drives. The issue is if I use the VM template tool in form view to add the m.2 drives to another VM that has a manually modified XML config template. My second VM boots fine. When I use to VM template form view to modify the config (rather than the config directly using the "xml text" toggle) it messes up my manually modified XML config. The system won't boot then.

 

In other words, what I'm trying to figure out is what text lines do I need to add to my VM's XML configuration to get the two m.2 drives to do the passthrough? (i.e. rather than using the form view)

 

 

(Edit:" The devices below are available as an option in the VM's form view but if I check the boxes and click update the VM doesn't boot. I have to repaste a backup of the xml config to get it to boot again)

 

Other PCI Devices:

        AMD RAID Bottom Device | Non-Volatile memory controller (43:00.0)
        AMD RAID Bottom Device | Non-Volatile memory controller (44:00.0)

Edited by JKunraid

  • Community Expert
  • Solution
42 minutes ago, JKunraid said:

Thanks again for reply Simon. Not following you though.

 

I've already done the vfio bind in system devices and confirmed I can add the m.2 drives to another basic VM using Unraids VM template GUI. That VM boots fine and adds the drives. The issue is if I use the VM template tool in form view to add the m.2 drives to another VM that has a manually modified XML config template. My second VM boots fine. When I use to VM template form view to modify the config (rather than the config directly using the "xml text" toggle) it messes up my manually modified XML config. The system won't boot then.

 

In other words, what I'm trying to figure out is what text lines do I need to add to my VM's XML configuration to get the two m.2 drives to do the passthrough? (i.e. rather than using the form view)

 

 

(Edit:" The devices below are available as an option in the VM's form view but if I check the boxes and click update the VM doesn't boot. I have to repaste a backup of the xml config to get it to boot again)

 

Other PCI Devices:

        AMD RAID Bottom Device | Non-Volatile memory controller (43:00.0)
        AMD RAID Bottom Device | Non-Volatile memory controller (44:00.0)

The pci devices will in hostdev sections the source will match the pci id i.e. bus=43 slot=00 feature=0

 

Do you specify a boot order for the boot device in the form view?

 

post xml.

  • Author
33 minutes ago, SimonF said:

The pci devices will in hostdev sections the source will match the pci id i.e. bus=43 slot=00 feature=0

 

Do you specify a boot order for the boot device in the form view?

 

post xml.

 

Yes. A virtio vdisk is set to "1" on boot field. It has a working OS.  The m.2 drives are for secondary drives not operating system... I have nearly the same setup on the simpler VM and i have no issue using the form view to add them in. It's the manually modified xml VM that has the issue.  I could start from scratch again but I took hours to get the VM working for my particular configuration. It would be a lot simpler if I could add the lines into the xml manually.

 


 

 

 

 

Edited by JKunraid

  • Author
49 minutes ago, SimonF said:

The pci devices will in hostdev sections the source will match the pci id i.e. bus=43 slot=00 feature=0

 

Do you specify a boot order for the boot device in the form view?

 

post xml.

 

UPDATE: 


I did of search of devices with bus 43 (and 44) as you suggested using the broken XML.  As the XML was nested I assumed the parent lines of XML were also required.  I added these lines to working XML config just above the <memballon model='none'/> line. It booted and showed the two drives. I need to spend a bit of time making sure I haven't broken anything but as it stands it seems to be working.. I'll update as soon as I know for sure.

 

  <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x43' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x44' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>

Edited by JKunraid

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.