https://stackoverflow.com/questions/52153889/get-device-name-from-pcie-slot-number
I have 4 SSD cards plugged into my system. They show up as /dev/nvme[0-3]n1.
Using lspci -vvv I can get the PCIE slot numbers of these 4 cards. But how to match the PCIE slot number with the device name? For example one of the cards has the slot number 3b:00:0. What is the corresponding /dev/nvme[0-3]n1?
I have gone through /sys/bus/pci/devices but not found what I'm looking for. Google has not thrown up any answers either.
TIA cheers
asked Sep 3 '18 at 17:06
33
closed as off-topic by Ben Voigt, rsjaffe, PerracoLabs, phuclv, Narendra Jadhav Sep 4 '18 at 4:00
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Ben Voigt, rsjaffe, PerracoLabs, phuclv, Narendra Jadhav
If this question can be reworded to fit the rules in the help center, please edit the question.
-
For a one time shot, try looking at the resulting file from
sudo lshw -html > ~/Desktop/hardware_file.html
– ivanivan Sep 3 '18 at 17:09
add a comment
1 Answer
0
You may try searching for device name somewhat like this:
grep "3b:00.0" /sys/class/nvme/*/device/uevent
Then you will need to extract device name from the output:
/sys/class/nvme/nvme0n1/device/uevent:PCI_SLOT_NAME=0000:3b:00.0
This will be the string in place of the asterisk.
answered Sep 3 '18 at 21:01