How to bind your GPU to vfio at boot without affecting Unraid

To bind your GPU to VFIO at boot without affecting Unraid, follow these steps:

Steps to Bind GPU to VFIO

  1. Enable IOMMU in BIOS: Ensure that IOMMU is enabled in your BIOS settings. This is crucial for passing through individual components to virtual machines. You may also want to enable SR-IOV if available.

  2. Identify PCI Devices: Go to the Unraid webGUI and navigate to Tools → System Devices. Here, you can see all your hardware and their respective IOMMU groups. Identify the PCI ID of the GPU you want to bind (e.g., 02:00.0 for the GPU and 02:00.1 for the audio device associated with it).

  3. Use the VFIO Binding Method:

    • Starting from Unraid 6.7, you can bind devices by specifying their PCI IDs in a configuration file. Create or edit the file located at config/vfio-pci.cfg on your USB flash boot device.
    • Add a line in this format:
      BIND=02:00.0 02:00.1
      
    • This line will bind both the GPU and its audio component to VFIO, preventing them from being used by the host system.
  4. Modify Syslinux Configuration (if needed):

    • If you’re using an older version of Unraid or prefer using Syslinux, you can modify the syslinux.cfg file found in /boot/syslinux/. Add or modify a boot option with:
      append initrd=/bzroot earlymodules=vfio-pci video=efifb:off,vesafb:off gfxpayload=text
      
    • This ensures that VFIO is loaded early during the boot process.
  5. Reboot Your System: After making these changes, reboot your Unraid server for the changes to take effect.

Considerations

  • Impact on Unraid: Binding a GPU to VFIO should not affect your Unraid webGUI as long as you do not bind essential devices (like storage controllers or network interfaces) that Unraid depends on. If you bind your only video card, ensure you have another method (like a serial console) to access Unraid during troubleshooting.

  • Testing Configuration: After binding, create a VM with the GPU assigned and test its functionality. If you encounter issues, you can revert changes by deleting or renaming the vfio-pci.cfg file and rebooting.

By following these steps carefully, you should be able to bind your GPU to VFIO effectively without disrupting your Unraid setup.
If any issues comment below.