8

I would like to see how many PCI slots I have in a server and how many of them are in use. Is this possible with just some Linux commands? (lspci doesn't seem to provide the exact information I need.)

2 Answers2

17

May be you can use:

dmidecode -t 9

For getting number of slots:

dmidecode -t 9 | grep "System Slot Information" | wc -l

For getting count of available:

dmidecode -t 9 | grep -A3 "System Slot Information" | grep -c -B1 "Available"

More info dmidecode.

taliezin
  • 9,275
2

EDIT - What might be better for you is sudo lspci | grep PCI

I would recommend sudo lspci as this will tell you every port as well as when is plugged into them. Otherwise it will just list the port and something generic.

lspci man page excerpt:

lspci is a utility for displaying information about PCI buses in the system and devices connected to them.

Keep in mind that this will list every interface on the bus not just what most would think of as traditional pci slots...

Dylan
  • 1,038