Ever needed to find out what hardware runs a specific server without knowing anything about this system? Well, this happens to me from time to time. But since we are Linux sysadmins we know that there are possibilities to find out what we are dealing with.
Let’s assume you are currently in such a situation and need to obtain information about the network card of a Linux box.
Our first choice: /var/log/dmesg
In most cases, /var/log/dmesg already contains some valuable hints:
less /var/log/dmesg -> search for eth0 in this case bnx2 0000:03:00.0: eth0: Broadcom NetXtreme II BCM5709 1000Base-T (C0) PCI Express found at mem ee000000, IRQ 35, node addr *secret*
So we found out that our system is equipped with a Broadcom NetXtreme card.
Same info with lspci
We could have obtained these details with lspci also, as my sample output will show you:
lspci |less -> search for Ether 02:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
Unfortunately we learned nothing new, so let’s move on quickly.
More details with hwinfo
Install hwinfo on the target system and let it run. Unfortunately it could take a while until this tool has gathered all information, so I highly recommend to pipe the output to a file:
apt-get install hwinfo hwinfo >local_hw_info.log less local_hw_info.log -> search for Ether info.product = 'NetXtreme II BCM5709 Gigabit Ethernet'
I guess I took a bad server for this specific example! hwinfo often shows the most details, but in this case, it only shows the same information as the two previous methods did before.
However, when performing your research on HP servers for example you will see that hwinfo shows the most detailed information, such as the specific card model number.
If you need to find out more about the USB devices, you could use lsusb.
There is also lshw if you want to know a good alternative to hwinfo. Some even consider lshw to have the best output of all known hardware detection tools. When focusing on RAM, dmidecode might be a very good choice.
If you are looking for a hw tool with a decent GUI you should check out hardinfo.
Comparing the output for a HP server (focusing on one of the network cards)
In the last part of this blog post I want to compare the output of dmesg, lspci, hwinfo, lshw, dmidecode and hardinfo for you. Please note that I only compare the relevant information with each other.
netxen_nic 0000:08:00.0: eth4: XGbE port initialized netxen_nic: Dual XGb SFP+ LP Board S/N ZQ23BK1070 Chip rev 0x42 (no card model name shown)
Ethernet controller: NetXen Incorporated NX3031 Multifunction 1/10-Gigabit Server Adapter (rev 42)
Model: "Hewlett-Packard Company NC522SFP Dual Port 10GbE Server Adapter" Vendor: pci 0x4040 "NetXen Incorporated" Device: pci 0x0100 "NX3031 Multifunction 1/10 Gigabit Server Adapter" SubVendor: pci 0x103c "Hewlett-Packard Company" SubDevice: pci 0x705b "NC522SFP Dual Port 10GbE Server Adapter
product: NX3031 Multifunction 1/10-Gigabit Server Adapter vendor: NetXen Incorporated
(Only output for the other network card was shown, but not for our dual port one.)
Device: pci 0x0100 "NX3031 Multifunction 1/10 Gigabit Server Adapter"
In our test scenario hwinfo proved as the most reliable and detailed hardware detection tool. Maybe you have made other or similar experienced with hardware detection tools? I would be happy if you post a comment about it!