Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Linux, is there a way to find out which PCI card is plugged into which PCI slot?

Tags:

In Linux, is there a way to find out which PCI card is plugged into which PCI slot?

/sys/bus/pci/devices/ contains many devices (bridges, CPU channels, etc.) that are not cards and I was not able to find any information about slot-card mappings in the device directories.

like image 797
magmabyte Avatar asked Sep 18 '14 09:09

magmabyte


People also ask

How do I know what PCI card I have Linux?

Method 3: Displaying Open PCI Slots Back at the terminal, you can run sudo dmidecode -t 9 | grep -A3 “System Slot Information” | grep -c -B1 “Available” to find out just how many PCI slots you have that are empty.

How do I know which PCI slot I have?

Download and install CPU-Z. Once installed, open it and head to the 'Mainboard' tab. Under the “Graphic Interface” tab, you'll see what type of PCIe connection you have, along with its link width. Look for 'x16' in 'Link Width' and 'PCI-Express 3.0' under 'Version'.

How can I see what is plugged into PCI Express?

You can also access the Device Manager by pressing "Windows-X" and selecting "Device Manager" from the menu. You can also visually identify the connected PCI cards in a computer by opening the casing and examining devices connected to the computer's PCI buses.

What command would you use to identify what PCI cards are installed?

lspci stands for list pci. Think of this command as “ls” + “pci”. This will display information about all the PCI bus in your server. Apart from displaying information about the bus, it will also display information about all the hardware devices that are connected to your PCI and PCIe bus.


Video Answer


2 Answers

You can use

dmidecode –t slot 

to find all available pci slots than you can run

lspci -s <slot number> 

command to list device connected to specified slot. You must take bus address from first command and use this address as parameter in second command.

like image 149
Nebojsa Susic Avatar answered Oct 09 '22 02:10

Nebojsa Susic


Nebojsa's answer is good, but here's a little more information and an answer to magmabyte's comment.

dmidecode gives you the number of slots, however, those slots are not the only things using the PCI bridge which is why you see many more devices than slots.

Secondly, you may see multiple "devices" per slot, but they are likely just multiple ports on the same card. To give you an example using network interface cards (NICs):

megaman@someserver $ lspci | grep 10Gb 07:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (rev 02) 07:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (rev 02) 

dmidecode indicates that this server has three slots (and it does). Slot 1 has the 10Gb NIC above (you can see that it has 2 ports), slot 2 has a fibre channel card (which also happens to have 2 ports), and finally slot 3 is empty.

There are three physical slots in the server, one is empty, two are filled with multi port cards (an HBA and a NIC).

To answer your question in the comment, the 3 slots you have are the ones indicated by dmidecode and they are likely populated with multi port interface cards.

like image 29
kodywilson Avatar answered Oct 09 '22 04:10

kodywilson