Add Controller or NVMe to VM
Pass a whole SATA / SAS host bus adapter (HBA) or NVMe device into a Proxmox VM via PCI passthrough. ProxMenux checks and — with your consent — enables IOMMU, enumerates the passthrough-eligible devices, filters out conflicts and wires the assignment with qm set --hostpci.
What this does (and does not) do
vfio-pci. The VM sees the controller itself — not the individual disks behind it — and loads its own driver for that exact model. Every disk attached to that controller follows it automatically, with native SMART data, full firmware features and no Proxmox layer in between.How the script runs
The flow has two phases with clear separation between "collecting information, checking IOMMU and listing candidates" and "actually attaching the PCI device". Until the final confirmation nothing is written to the VM config.
┌─────────────────────────────────────────────┐
│ PHASE 1 — Detect, validate, plan │
│ (nothing touched yet) │
└──────────────────┬──────────────────────────┘
▼
qm list — user picks target VM
├─ VM running? → reject
└─ Machine type not q35? → reject
│
▼
IOMMU status
├─ Active, or already in the cmdline
│ (reboot pending) → continue
│
└─ Not configured → offer to enable
CPU vendor detect (cat /proc/cpuinfo)
├─ Intel → intel_iommu=on iommu=pt
└─ AMD → amd_iommu=on iommu=pt
Into:
├─ /etc/kernel/cmdline (systemd-boot)
│ + proxmox-boot-tool refresh
└─ /etc/default/grub (GRUB)
+ update-grub
Flow continues; reboot offered at the end
│
▼
Enumerate storage-class PCI devices
(/sys/bus/pci/devices, class 01xx)
└─ Resolve the disks behind each one
│
▼
Eligibility filter
├─ Already in this VM's hostpci? → hide
├─ A disk holds the Proxmox system
│ or is used by a running VM/CT
│ → hide (listed as "Hidden for safety")
└─ A disk is referenced by a stopped
VM/CT → show with ⚠
│
▼
User selects device(s) via checklist
└─ SR-IOV VFs / active PFs → excluded
│
▼
Conflict policies
├─ Device in another VM's hostpci
│ ├─ owner running → skip device
│ └─ owner stopped → keep + onboot=0
│ / move to target / skip
└─ Disk referenced by stopped VM/CT
→ onboot=0 / remove refs / skip
│
▼
Summary + compatibility notice
(flags old BIOS / low-power CPUs)
│
┌──────── Cancel OR Confirm ────┐
▼ ▼
Exit, nothing ┌─────────────────┴─────────────────┐
was changed │ PHASE 2 — Apply │
└─────────────────┬─────────────────┘
▼
For each selected device:
├─ Find next free hostpciN slot
│ (scans qm config)
└─ qm set <VMID> --hostpciN \
<BDF>,pcie=1
(e.g. 0000:01:00.0,pcie=1)
│
▼
If IOMMU was just enabled:
└─ offer to reboot now; otherwise
do not start the VM until the
host has rebooted
│
▼
Guest on next boot sees the
controller directly + every disk
behind it (full SMART, native
firmware features, no Proxmox layer)IOMMU groups — why the whole card leaves at once
The isolation boundary for PCI passthrough is the IOMMU group, the smallest unit the CPU’s IOMMU can isolate. Devices in the same group cannot be isolated from each other. If a SATA controller shares its group with a USB controller, passing through SATA may also require releasing USB from the host, or may prevent passthrough. It does not automatically assign every device in the group to the VM.
Host PCIe bus — grouped by IOMMU
│
▼
┌─────────────────────────────────────────┐
│ Group 12 │
│ ──────── │
│ 00:17.0 SATA HBA │
│ └── sda sdb sdc sdd │
│ │
│ Pass-through takes: │
│ the HBA + every disk on it │
│ │
│ ✓ clean — no extra members in group │
└──────────────────┬──────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Group 13 │
│ ──────── │
│ 01:00.0 NVMe controller │
│ │
│ Pass-through takes: │
│ the NVMe controller itself │
│ │
│ ✓ clean — NVMe alone in its group │
└──────────────────┬──────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Group 14 │
│ ──────── │
│ 02:00.0 SATA HBA │
│ └── sde sdf │
│ 02:00.1 USB 3.0 controller │
│ │
│ Pass-through takes: │
│ SATA HBA + USB 3.0 controller │
│ (whole group leaves together) │
│ │
│ ⚠ shared group — the USB ports will │
│ also leave the host. Review whether │
│ that is acceptable before confirming.│
└─────────────────────────────────────────┘ProxMenux does not check IOMMU groups. Before you pass a card through, check its group with the manual commands below: if the group holds more than the controller you want, the other devices leave the host with it.
Prerequisites
- CPU and motherboard support VT-d (Intel) or AMD-Vi, and it is enabled in firmware (BIOS/UEFI). ProxMenux can enable the kernel side for you, but it cannot flip the firmware switch.
- The target VM is powered off before attaching PCI devices.
- The target VM uses the q35 machine type. ProxMenux rejects other machine types.
- The controller/NVMe is not the one holding the Proxmox root filesystem. The script hides anything in use by the host.
- Guest OS has drivers for the controller model. Linux covers virtually every HBA out of the box; Windows needs the vendor driver installed before you boot with the controller attached.
Live migration is not possible
Step-by-step
Pick the target VM
ProxMenux reads qm list and shows every VM with its status and machine type. Pick the one that will receive the controller. A running VM, or one whose machine type is not q35, is rejected.
VM selection dialogIOMMU check
If IOMMU is not active, ProxMenux offers to enable it. It edits /etc/kernel/cmdline (for systemd-boot) or /etc/default/grub (for GRUB), appends the parameters for your CPU and runs proxmox-boot-tool refresh or update-grub:
intel_iommu=on iommu=ptfor Intel CPUs.amd_iommu=on iommu=ptfor AMD CPUs.
The flow continues and the devices are assigned in the same run, but the host must reboot before the VM starts. At the end ProxMenux offers to reboot now; if you decline, do not start the VM until the host has rebooted.
IOMMU Required — offer to enable and rebootDevice enumeration
ProxMenux lists every storage-class PCI device (SATA / SAS / RAID HBAs and NVMe). For each device it shows:
- PCI address (
0000:00:17.0,0000:01:00.0, …). - Vendor / device description.
Assigned to VMwhen another VM already has the device in its config.- A ⚠ marker when a disk behind the controller is referenced in a stopped VM or CT config.
Controller / NVMe device enumerationConflict detection
Controllers with a disk that holds the Proxmox system or is used by a running VM or CT are hidden for safety and listed in the dialog, and so are devices already in the target VM. SR-IOV virtual functions, and physical functions with active VFs, are excluded after selection. If another VM already has the device, a running owner blocks it; for a stopped owner you choose to keep it there with onboot disabled, move it to the target VM or skip it. Disks referenced in stopped VM or CT configs get a similar choice: disable onboot, remove the references or leave them as they are.
Conflict detection — device blocked with reasonAttach and finalise
ProxMenux shows a summary with a compatibility notice (on some platforms the host slows down or freezes when the VM starts; old firmware and low-power CPUs are flagged). On confirm, for every selected device it runs qm set <VMID> --hostpciN <pci-addr>,pcie=1, choosing the next free hostpci slot. If IOMMU was enabled during this session, it offers to reboot the host.
Assignment summary — hostpciN slots and PCI addresses attachedManual equivalent
# 1. verify IOMMU is active
dmesg | grep -iE "DMAR|IOMMU" | head
ls /sys/kernel/iommu_groups/
# 2. list IOMMU groups and their members
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=$(basename "$d"); g=$(dirname "$(dirname "$d")")
printf 'group %3d %s %s\n' "$(basename "$g")" "$n" \
"$(lspci -s "$n" | cut -d' ' -f2-)"
done | sort -n
# 3. attach a storage controller at PCI 0000:00:17.0 to VM 101
qm set 101 --hostpci0 0000:00:17.0,pcie=1
# 4. verify
qm config 101 | grep ^hostpciTroubleshooting
IOMMU enabled but no groups under /sys/kernel/iommu_groups/
VM fails to start with "hostpciN: device busy"
lspci -nnk -s <addr> to see which driver is bound; it should be vfio-pci. A full host reboot usually clears this.Guest sees the controller but not the disks
The IOMMU group includes an unrelated device
Related
- Import Disk to VM — alternative model: attach a physical disk via Proxmox without full PCIe passthrough.
- Add GPU to VM (Passthrough) — same IOMMU / VFIO concepts applied to a GPU.
- GPU Passthrough commands — IOMMU verification commands also apply to controller / NVMe passthrough.
- Disk Manager overview.