Reading the hardware inventory with dmidecode

Video 062 of 140 in Virtualization Foundations, in the unit “Server hardware and out-of-band management”. 4:34, with English and Hindi audio.

Every data centre keeps a list of its servers, with each model, serial number and amount of memory. A list drifts, because a part is swapped during a repair and nobody updates it. This article shows a more trustworthy source, the firmware's own record of the machine. It explains the dmidecode command that reads that record on Linux, the commands to run, and the cautions that go with them.

What you will learn

Why read the machine instead of the list

A list someone typed can drift. A part is swapped during a repair, nobody updates the list, and so the list stays wrong. The firmware already knows the machine's details, so reading them directly is more trustworthy than a record typed by hand.

At Harbor Point Logistics, the team records each host's model and BIOS version before any firmware change, then checks them again afterwards.

What the firmware records

The firmware writes a table of hardware facts at every boot. This table is called SMBIOS, which stands for System Management BIOS. It holds facts such as the model, the serial number and the installed memory.

The dmidecode command turns the raw table into names and values that a person can read. You choose what to read: everything, one type of part, or one keyword.

Four commands for the main facts

Reading this table needs administrator rights, so each command starts with sudo. The first three commands read one keyword each: the manufacturer, the product name and the serial number. The fourth reads the memory devices, which is the one to use when you add up the memory.

What the output tells you

Before a firmware change, record the model and BIOS version. After the change, run the same commands again and confirm that the new version shows. Then add up the memory the modules report, and compare the total with what the host should carry.

Cautions when you read inventory

Read the main facts from a Linux server

You need a Linux server with administrator rights. Run each command in turn, and compare each answer with the label on the machine or with the part you can see.

  1. Read the manufacturer's name. Administrator rights are needed, so start the command with sudo.

    sudo dmidecode -s system-manufacturer
  2. Read the product name, which is the model of the server.

    sudo dmidecode -s system-product-name
  3. Read the serial number. Keep the output private, because it identifies the asset.

    sudo dmidecode -s system-serial-number
  4. List the memory devices, and add up their sizes to check what is fitted.

    sudo dmidecode -t memory

Terms

SMBIOS
System Management BIOS: a table of hardware facts that the firmware writes into memory at every boot.
dmidecode
A Linux command that reads the hardware table and prints its facts as names and values a person can read.

Check yourself

Where does dmidecode get the model and the serial number?

From the SMBIOS table, which the firmware writes at every boot with the hardware facts.

Why do the dmidecode commands start with sudo?

Reading this table needs administrator rights. Without them, the command cannot read the table and fails.

Why record the BIOS version before a firmware change?

So you know what was there before, and can confirm afterwards that the new version shows.

Previous: Hardware RAID or plain HBA mode. Next: From power-on to login.