Identifying CPUs and PCI Devices with lscpu and lspci
Before you resize a volume, swap a failed NIC or plan a hardware refresh, you need a factual record of what sits inside the box. lscpu summarises the processor topology and the features the CPU exposes; lspci enumerates every device attached to the PCI and PCI Express buses. On RHEL, CentOS Stream and Fedora both ship with the base system, so a complete hardware inventory costs one terminal session.
That is worth more in Australia than in most markets. A rack in a Canberra federal agency sits a long way from a spare-parts shelf, and a control room in the Pilbara or a satellite-linked site outside Darwin has even less. The same kit is ordered, racked and decommissioned in Sydney, Melbourne, Brisbane and Perth, where budgets are approved in Australian dollars and purchases must clear local tender, warranty and distributor arrangements before hardware can be bought at all.
Inventory also settles arguments that otherwise run for weeks. Which socket owns a given core? Is the HBA running a signed Red Hat driver or a community module? Was that PCIe error present before the firmware upgrade? The first two questions take seconds, the third by comparing today's output against a snapshot kept from earlier — worth building into your change routine, right beside keeping automatic backups with cron in place so configuration can be rolled back when a change misbehaves.
What follows covers the fields worth understanding, the options that make the output scriptable, and the checks that turn a wall of hexadecimal identifiers into a usable hardware map. The procedure is deliberately repeatable: capture the output, read the topology, confirm the drivers, file the result against the asset record, and repeat it after any change.
Why an inventory beats an assumption
Server surprises are rarely dramatic. A host sold with 32 cores presents 24 because a BIOS setting caps the socket count. A RAID controller enumerates as a plain SCSI controller until its driver loads. A fibre adapter appears with a kernel module in use that nobody had noticed. None of these break a running system, yet each quietly invalidates capacity plans, spares lists and monitoring thresholds.
Distance makes such mistakes expensive here. Freight to a mine gate near Kalgoorlie or Newman takes longer than the swap itself takes in a city data centre, and border paperwork can add weeks. Energy operators running rigs near Gladstone hold their own spares precisely because a replacement part cannot be couriered in an hour, and deciding what to hold starts with knowing the exact board and card identifiers on site. A note reading "it's a 10GbE card" is no help when the spare has to carry the right vendor and device ID.
Records also have to line up with local wall-clock time. Logs from a Canberra appliance running AEDT and a Perth box running AWST need normalising against UTC before they can be compared, particularly around the daylight saving changes in April and October. Stamping each inventory with the UTC offset, kernel version and BIOS revision keeps it usable months later, even after the person who captured it has moved to another project.
Reading processor topology with lscpu
Plain lscpu output is a summary table with the useful fields near the top: architecture, CPU count, threads per core, cores per socket, socket count, NUMA nodes, vendor and model identifiers, virtualisation type and cache sizes. Multiply the three topology numbers and you get the logical CPU count the kernel sees, which is the figure that matters when a container limit or a licensing calculation is checked. Getting that arithmetic right avoids reading "24 cores" when the machine actually offers 48 threads.
lscpu -e lists every logical processor with its core and socket identifiers, lscpu -p emits parsable output for shell scripts, and lscpu -J returns JSON that pairs neatly with jq across a fleet. JSON is the safer choice for anything automated, since field names stay stable while the human-readable table can change wording between releases. Which processors are online also shows in /sys/devices/system/cpu/online, which matters when a faulty core has been taken out of service rather than replaced.
The flags line carries the other half of the story. Searching it for aes confirms hardware encryption, avx2 or avx512f indicates the vector instruction sets a database workload can use, and hypervisor shows the CPU reports to a virtualised environment. On a VM, lscpu names the hypervisor vendor, which prompts a comparison against the host's own summary before anyone chases a performance problem.
Walking the PCI bus with lspci
lspci prints one line per device: bus, slot and function numbers, a class description, and a vendor and device name resolved from the PCI ID database. Adding -nn prints numeric vendor and device IDs too, and that is the format to keep in a record because it survives changes to the local pci.ids file. Classes such as Ethernet controller, Non-Volatile memory controller and SCSI storage controller reveal the roles the machine is playing, while bridge and VGA entries show what the firmware found in the chassis.
Verbose modes add the detail that matters during maintenance. lspci -v exposes registers and capabilities, lspci -vv adds interrupt and MSI-X information, and lspci -k shows the kernel driver and modules bound to each device. The tree view from lspci -t maps devices onto their buses, confirming whether a card sits behind a PCIe switch or directly on the root complex — useful when physical slot numbers do not match the output.
The driver line is the practical payoff. A Broadcom card bound to bnxt and an Intel X710 bound to i40e behave differently under load, and a Red Hat signed module from /lib/modules/$(uname -r)/extra carries support commitments a community build lacks. When procurement specifies an "equivalent adapter", the recorded vendor and device IDs tell the buyer whether the substitution will work with the drivers already installed.
Confirming bindings and watching the kernel
A device that enumerates but performs badly is usually a binding or firmware problem, and the kernel log says so. Messages containing pcieport and AER, the PCIe error reporting strings, point to corrected or fatal link errors on a specific bus and slot. Pairing dmesg -T with the bus and function numbers from lspci narrows a hardware fault to a physical card in minutes, which matters in a mine switch room hours from the nearest technician.
Firmware changes are the other common trigger. After replacing a card or reflashing a RAID controller, run both commands again and compare the output side by side; a changed device ID or a driver that has fallen back to a generic module is visible at once. The same comparison after a kernel upgrade shows whether a module stopped loading, which is why a dated snapshot stored next to the change record beats a note buried in a handover document.
Field engineers increasingly carry Android tablets into equipment rooms, and a small internal app that signs into the inventory portal saves a lot of typing. Androidtutorialpoint's walkthrough of a simple Kotlin login screen is a reasonable starting point for building one, since authentication is the hurdle stopping staff from opening the record on a phone. Pair it with a copy of the capture script and the hardware history stays current without anyone remembering to update it.
Checks worth keeping in your runbook
Two short lists cover most of what a working inventory needs:
-
Core commands and the first field to read
lscpu— architecture, CPU count, cores per socket, threads per corelscpu -J— stable JSON for scripting across a fleetlspci— class, vendor and device name for every bus devicelspci -nn -k— numeric IDs plus the driver bound to each device
-
Details to capture with every snapshot
- Hostname, asset tag, kernel release and BIOS revision
- Socket, core and NUMA layout from
lscpu -e - Vendor and device identifiers from
lspci -nn - UTC offset, capture date and the related change reference
The habit worth keeping is small and durable: run lscpu and lspci before and after every hardware or firmware change, file the output beside the change record, and read the vendor and device IDs as the fingerprint of the machine. When a spare board turns up in a Perth warehouse or a replacement card is couriered to Kalgoorlie, that fingerprint tells you whether the part fits, whether the driver is already on the host, and whether the maintenance window can go ahead as planned.