How to Pass Through an NVMe Drive Directly to a VM in Proxmox

NVMe passthrough in Proxmox provides exactly that, giving a VM raw, direct control over a physical drive.

Running a VM-based NAS solution like TrueNAS Scale () generally works best when it has direct, unmediated access to the actual physical storage rather than a virtualized disk image sitting on top of Proxmox’s own storage layer. NVMe passthrough in Proxmox provides exactly that, giving a VM raw, direct control over a physical drive.

Why Direct Disk Passthrough Matters for Storage VMs

When a storage-focused VM like TrueNAS manages disks through Proxmox’s virtualized disk layer instead of direct hardware access, it loses visibility into real drive health data (SMART attributes) and can’t take full advantage of features like ZFS’s direct hardware access assumptions. Passing the physical NVMe drive through directly resolves this, letting the guest OS interact with the actual hardware exactly as if it were physically connected to that specific VM alone.

PCIe Passthrough vs Disk Passthrough

There are two distinct approaches for giving a VM more direct NVMe access:

  • Full PCIe passthrough – passes through the entire NVMe controller as a PCIe device, using the same IOMMU-based mechanism covered in the earlier GPU passthrough guide, giving the VM complete, exclusive control
  • Direct disk passthrough – passes through the drive as a raw block device without the full PCIe-level isolation, simpler to configure but with slightly less complete isolation than true PCIe passthrough

For dedicated storage VMs like TrueNAS where a specific NVMe drive is meant entirely for that VM’s use, full PCIe passthrough is generally the more robust, recommended approach.

Prerequisites

This requires the same IOMMU setup covered in the earlier GPU passthrough guide — enabled in BIOS, configured in GRUB, with VFIO kernel modules loaded. If you’ve already set up GPU passthrough on this host, most of this foundational configuration is already in place.

Identifying the NVMe Drive’s PCIe Address

lspci | grep -i nvme

This shows output like:

02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller

Note the PCIe address (02:00.0 in this example).

Checking the Drive’s IOMMU Group

Confirm the NVMe controller sits in its own isolated IOMMU group, or at least one not shared with anything else you need on the host:

find /sys/kernel/iommu_groups/ -type l | grep 02:00.0

If the drive shares a group with unrelated devices you need to keep on the host, passthrough may not be cleanly possible without also passing through those other devices, similar to the IOMMU grouping limitations covered in the GPU passthrough guide.

Binding the Drive to VFIO

Similar to the GPU passthrough process, create a configuration blacklisting this specific device from Proxmox’s own NVMe driver and assigning it to VFIO instead:

echo "options vfio-pci ids=144d:a808" | sudo tee /etc/modprobe.d/vfio-nvme.conf

(Replace the ID with your actual NVMe controller’s vendor and device ID, found via lspci -nn.)

Update initramfs and reboot:

sudo update-initramfs -u -k all
sudo reboot

Verifying the Drive Is No Longer Used by the Host

After reboot, confirm the drive no longer appears as usable storage on the Proxmox host itself:

lsblk

The passed-through NVMe drive should be absent from this output, confirming it’s now exclusively controlled by VFIO rather than the host’s own filesystem.

Adding the Device to a VM

In the Proxmox web UI:

  1. Select the target VM (your TrueNAS Scale VM, for instance).
  2. Go to Hardware → Add → PCI Device.
  3. Select the NVMe controller from the list.
  4. Ensure All Functions is checked.
  5. Save and start the VM.

Verifying Passthrough Inside the Guest

Once booted, confirm the guest OS sees the drive directly:

lsblk

Or within TrueNAS Scale’s own storage management interface, where the drive should appear as a real physical disk available for pool creation, exactly as if it were natively connected.

A Simpler Alternative for Less Critical Use Cases

For scenarios where full PCIe passthrough’s added complexity isn’t justified, Proxmox also supports simpler raw disk passthrough directly through the VM’s hardware configuration (qm set <VMID> -scsi1 /dev/disk/by-id/...), giving the VM direct block-level access without the full PCIe isolation — a reasonable middle ground for less critical storage needs where the added complexity of true PCIe passthrough isn’t necessary.

Final Thoughts

Setting up NVMe passthrough in Proxmox ensures storage-focused VMs like TrueNAS Scale get the real, direct hardware access their storage management (particularly ZFS) is designed to expect, rather than an additional virtualization layer potentially interfering with SMART monitoring and hardware-level assumptions. Combined with the GPU and USB passthrough techniques covered in earlier guides, it rounds out Proxmox’s hardware passthrough capabilities for the specific cases where a VM genuinely needs unmediated physical hardware access.

Related Posts

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *