[SOLVED] Can't identify two identical nvme drives for PCIe passthrough

nitrosont

Member
Jul 8, 2020
3
1
8
68
I've got two identical NVMe drives (same model, same capacity) in my system.
One drive I use for PVE storage. The other I'd like to passthrough to a vm.
When I go into the settings of the vm, Idk which drive to select, because Idk which one is which.

On the disks overview on the node, the drives aren't shown with their IOMMU group nor with their ID. I can only distinguish them by their serial number.
When I try to run something like
Code:
lspci -v
I get the IOMMU groups and the ID but now combined with the serial number. It just shows
Code:
Device Serial Number 00-00-00-00-00-00-00-00

I cannot wrap my head around, how to identify which drive (which IOMMU number, or ID) is which one.

I don't want to risk the 50:50 chance and passthrough the nodes storage to the vm instead of the free drive.
 
Last edited:
Ok, I asked AI to give me a hint. I'll try that when I'm back at the system:
One possible way to find the IOMMU group or the pci ID of your nvme drives is to use the
Code:
ls -la /dev/disk/by-path
command, which will show you the symbolic links from the device names to the pci addresses. Alternatively, you can also use the
Code:
nvme-cli
tool, which is a command-line interface for managing nvme devices. You can install it using
Code:
sudo apt install nvme-cli
and then use commands like
Code:
nvme list
or
Code:
nvme id-ctrl /dev/nvme0n1
to get more information about your nvme drives.
Which command exactly shows me the serial number of a nvme drive together with its iommu group?
According to the web search results, you can use the
Code:
nvme-cli
tool to get the serial number and the iommu group of a nvme drive in Linux1. For example, you can run the following command to list the nvme devices with their serial numbers and pci addresses:
Code:
sudo nvme list
Then, you can use the pci address to find the iommu group by looking at the /sys/kernel/iommu_groups directory. For example, if your nvme device has the pci address 0000:01:00.0, you can run the following command to find its iommu group:
Code:
ls -l /sys/kernel/iommu_groups | grep 0000:01:00.0
Alternatively, you can also use the lspci command with the -v option to show the iommu group of each pci device. For example, you can run the following command to show the iommu group of your nvme device:
Code:
lspci -v -s 0000:01:00.0
 
Last edited:
Ok, I figured it out.

  1. List the NVMe subsystem with
    Code:
    nvme list-subsys
  2. note the pci address of the corresponding drive - you can identify it via the serial number. Mine was
    Code:
    0000:02:00.0
  3. Find the corresponding IOMMU group with
    Code:
    lspci -v -s 0000:02:00.0
    mine was
    Code:
    IOMMU group 17
  4. use this group to identify the drive in the hardware section of the vm
 
  • Like
Reactions: hendrics

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!