Skip to content
Mohammad Awadallah
All posts

A GPU inside a VM: Proxmox passthrough for running local models

How to pass a whole GPU through to a Proxmox VE virtual machine for AI models, the usual pitfalls, and when an LXC container is the better choice.

4 min readAlso in:العربيةFrançais

If you have a Proxmox server and a GPU, there are two ways to run local models on it: pass the whole card through to a virtual machine, or share it with LXC containers. This article walks through the first, step by step, following Proxmox’s official documentation, then compares it with the second.

The commands come from the current Proxmox VE docs (9.2 shipped in May 2026 with Linux 7.0 as the default kernel). Try them first on a server you can reboot without affecting anyone.

Step one: IOMMU

Passthrough needs IOMMU, the CPU and motherboard feature that isolates each device’s memory access.

  1. In the BIOS: set VT-d (Intel) or IOMMU/AMD-Vi (AMD) to “Enabled”. The docs warn that “Auto” often isn’t the same thing.
  2. In the kernel: per the docs, IOMMU is on by default with AMD CPUs, and with Intel on kernels 6.8 and newer. On older kernels you need intel_iommu=on.
  3. Check:
dmesg | grep -e DMAR -e IOMMU -e AMD-Vi

Step two: IOMMU groups

Every PCI device belongs to a group, and passthrough works on the whole group. List them:

pvesh get /nodes/{nodename}/hardware/pci --pci-class-blacklist ""

Ideally the card (and its audio function) sits in a group of its own. If it shares a group with other devices, the best fix is usually moving it to another PCIe slot. The pcie_acs_override option you’ll find on forums is described by the docs as a last resort that isn’t without risks.

Step three: VFIO, and keeping the host driver away

The host must not use the card, so that vfio-pci can claim it and hand it to the VM.

  1. Load the VFIO modules in a file such as /etc/modules-load.d/vfio.conf:
vfio
vfio_iommu_type1
vfio_pci
  1. Bind the card to vfio-pci by device ID (find it with lspci -nn), in a file under /etc/modprobe.d/:
options vfio-pci ids=10de:xxxx,10de:yyyy

Or blacklist the card’s driver on the host (blacklist nouveau, for example).

  1. Update and reboot:
update-initramfs -u -k all

After the reboot, confirm with lspci -nnk that the card is using vfio-pci.

Step four: the VM settings

Per the docs, GPUs are most compatible with:

  • Machine type q35 and OVMF (UEFI) firmware.
  • CPU type host.
  • Adding the card with PCIe enabled and all functions:
qm set VMID -hostpci0 02:00,pcie=on

Writing the short address 02:00 without a function number passes all of the device’s functions — the GPU and its audio device together. You don’t need x-vga=on if the card is for compute rather than display.

Inside the VM, install the NVIDIA driver as on any normal machine, then check with nvidia-smi.

Two notes:

  • A VM with a passed-through device can’t be live-migrated to another server.
  • If you have more than one server, use Resource Mappings under Datacenter: define the device once by name, and attach it to VMs by name instead of by address.

The alternative: sharing the card with LXC containers

Since Proxmox VE 8.1 you can pass device files into a container with the dev0, dev1… options, and since 8.2 from the GUI. The approach is completely different: no IOMMU, no VFIO. The card stays with the NVIDIA driver on the host, and the container is given the /dev/nvidia* files to use it.

The official docs explain the dev option but don’t cover GPUs specifically. The method common on the Proxmox forum: install the full driver on the host, then install the same version inside the container without the kernel module (--no-kernel-module). The versions must match, because the container runs on the host’s kernel.

Which one to choose

VM (full passthrough):

  • Full isolation: its own kernel and driver, and host updates don’t break it.
  • The card serves one VM at a time (unless you use vGPU, which needs an NVIDIA license).
  • The VM’s memory is reserved in full on the host.
  • A longer first-time setup.

LXC container (sharing):

  • Several containers can use the same card.
  • Lighter, faster to start, no fixed memory reservation.
  • Tied to the host’s driver and kernel: every driver update on the host needs the same update in each container.
  • Weaker isolation, since containers share the host kernel.

The rule of thumb: if the card is dedicated to one important service — a model server, say — a VM is cleaner and easier to maintain in the long run. If you want several light services to share the card, containers fit better.

The takeaway

GPU passthrough on Proxmox is no longer an adventure: IOMMU in the BIOS, an isolated group, binding to vfio-pci, and a q35 VM with OVMF. Most problems come from IOMMU groups that aren’t isolated, or from the host driver grabbing the card before vfio-pci does. Start there when nothing works.