Know the hardware setup without opening the box

Here is a simple question.

Is there a way to know how many PCIe slots are available on the motherboard and how many of them are free without opening the CPU box?

Any tool provided by Manjaro or Linux in general?

I would be surprised if this would be possible as without any device being connected there are little chances to detect these available slots, that’s different to USB ports AFAIK.

I can see that it’s feasible as each slot has an identity, an ID but the likelihood of someone creating software to do this is slim because you can almost always find the manual online and read it.

If this exists it will likely be part of a system tool in winworld, but I haven’t looked, I always keep my manuals.

there is

lspci 
lsusb

from USB any iso linux

it will not warrantly that all pci has been detected , if there is a lock or special drm ( case for video cards ) you may not see , or error on analyze acpi from bios

example , my motherboard has thunderbolt port , not visible because bios give wrong @dress , so linux cant see them

1 Like
inxi -M

will show the make and model number of the motherboard

Use the make and model number in a websearch to find the manufacturer’s support for the motherboard
Manufacturer specifications should indicate the number and type of expansion slots available on the motherboard

If that information is not published in specifications, download the user manual
There is usually a diagram in the motherboard manual showing expansion ports

1 Like

There your go sir:

sudo dmidecode --type slot

example:

$ sudo dmidecode --type slot
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0019, DMI type 9, 17 bytes
System Slot Information
	Designation: PCIEX16_1
	Type: 32-bit PCI Express
	Current Usage: In Use
	Length: Short
	ID: 1
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:01:01.0

Handle 0x001A, DMI type 9, 17 bytes
System Slot Information
	Designation: PCIEX1_1
	Type: 32-bit PCI Express
	Current Usage: Available
	Length: Short
	ID: 2
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:03:15.0

Handle 0x001B, DMI type 9, 17 bytes
System Slot Information
	Designation: PCI1
	Type: 32-bit PCI
	Current Usage: Available
	Length: Short
	ID: 3
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:02:1c.6

Have a look at Current Usage: :wink:

4 Likes

That was useful. Thanks.

The command shows that ALL my PCIe slots are in use. Is there a way to know what cards are connected to what slots?

In general you ca do this:

for x in $(sudo dmidecode --type slot | grep Bus | sed -r 's/\s+Bus Address: //g'); do lspci -s $x; done

But not all vendors work flawless, sometimes you need to check how the Slot/Bus is numbered. Would be too easy if all Mainboards would count the same way…

lspci -vmm

Here you can see the the Slot Number and which Device it is. Explanation:

Slot: The name of the slot where the device resides ([domain:]bus:device.function). This tag is always the first in a record.

                  Bus Function
                   |    |
Slot:             01:01.0
                      |
                   Device 
           Domain Bus Function
               |   |    |
Bus Address: 0000:01:01.0
                      |
                   Device 

Consider also update the pci database: sudo update-pciids

With sudo lshw -class bridge,display you could get information in hierarchical order.

sudo lshw -class bridge,display -numeric -notime -html > /tmp/hw.html && exo-open --launch WebBrowser /tmp/hw.html
1 Like