In the operation and maintenance process of OpenStack, Kubernetes, physical machines, or virtualization platforms, the ability to quickly collect host hardware information is of great significance for problem diagnosis. Mastering the knowledge in this article indicates that you are an experienced engineer.
๐ง 1. Basic Information Identification
| Function | Command |
| View Product Model | <span><span>cat /sys/class/dmi/id/product_name</span></span> |
| View Vendor | <span><span>cat /sys/class/dmi/id/sys_vendor</span></span> |
| View Motherboard Model | <span><span>cat /sys/class/dmi/id/board_name</span></span> |
| View Serial Number | <span><span>cat /sys/class/dmi/id/product_serial</span></span> |
| View UUID | <span><span>dmidecode -s system-uuid</span></span> |
๐ Example Output
[root@reg ]# cat /sys/class/dmi/id/product_name
VMware Virtual Platform #esxi virtualization platform
#Other platforms
KVM Virtual Machine #kvm virtual machine
Alibaba Cloud #Alibaba Cloud host
This information can help you determine which virtualization platform the host is running on.
โ๏ธ 2. CPU Information
๐น View CPU Architecture and Cores
lscpu
๐น Determine if virtualization or AVX instruction set is supported
lscpu | grep -E 'vmx|svm|avx'
๐น View the number of physical CPUs and cores
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
cat /proc/cpuinfo | grep "cpu cores" | uniq
This information is commonly used for
- โข Analyzing performance bottlenecks
- โข Determining support for KVM / Docker virtualization
- โข Verifying cloud host CPU allocation strategy
๐พ 3. Disk and Storage Information
๐น View Disk Type and Serial Number
lsblk -o NAME,TYPE,SIZE,MODEL,ROTA,SERIAL,MOUNTPOINT
<span><span>ROTA=0</span></span>โ SSD<span><span>ROTA=1</span></span>โ HDD (Mechanical Disk)
๐น View Detailed Disk Attributes
udevadm info --query=all --name=/dev/sda | grep -E 'ID_MODEL|ID_SERIAL|ROTATION'
๐น NVMe SSD Viewing Method
nvme list
๐ These commands can help you determine whether the disk is solid-state, whether the model is consistent, and whether there are virtual disks.
๐ง 4. Memory and Slot Information
๐น View Memory Usage
free -h
๐น View the size, slot, type, and speed of each memory stick
dmidecode -t memory | grep -E 'Size|Locator|Type|Speed'
๐ก This can quickly determine which slots are empty and which memory frequencies do not match, making it a powerful tool for troubleshooting hardware issues.
๐ 5. Network and Virtual Network Card Identification
๐น View All Network Interfaces
DEVICE TYPE STATE CONNECTION
dq bridge connected dq
enP1s16f1 ethernet connected enP1s16f1
virbr0 bridge connected (external) virbr0
enP1s16f0 ethernet connected enP1s16f0
vnet0 tun connected (external) vnet0
vnet1 tun connected (external) vnet1
vnet2 tun connected (external) vnet2
enP2s1f0 ethernet disconnected --
enP2s1f1 ethernet disconnected --
enP2s1f2 ethernet disconnected --
enP2s1f3 ethernet disconnected --
docker0 bridge unmanaged --
lo loopback unmanaged --
virbr0-nic tun unmanaged --
๐น Status Explanation:
- โข dqใenP1s16f0/f1: Physically connected, managed by NetworkManager.
- โข virbr0 / vnet0~2: Created by
<span><span>libvirt</span></span>(KVM virtualization), detected by NetworkManager but not managed, status is “connected (external)”. - โข docker0: A virtual bridge created by Docker. NetworkManager does not manage it by default, as it may interfere with container networking.
- โข lo (loopback) and virbr0-nic: Also unmanaged devices, used by the system itself or libvirt.
- โข enP2s1f0~3: Physical network cards, currently not activated, meaning no network cable is connected.
๐น View All Network Interfaces
ip -br link
๐น View Detailed Parameters of a Single Network Card
ethtool eth0
In a Kubernetes environment, common network card descriptions are as follows
| Network Card | Description |
<span><span>cni0</span></span> |
Container Bridge Network Card (internal communication within containers) |
<span><span>flannel.1</span></span> |
Flannel VXLAN Tunnel Interface (cross-node communication) |
<span><span>cbr0</span></span> |
Kubernetes Bridge (common in older versions) |
๐งพ 6. System and BIOS Information
๐น View System Version
cat /etc/os-release
๐น View Kernel Version
uname -r
๐น View BIOS Information
dmidecode -s bios-version
dmidecode -s bios-release-date
๐ 7. Unique Machine Identification (Identity Recognition)
๐น System Unique Identifier
cat /etc/machine-id
๐น System UUID
dmidecode -s system-uuid
๐ก This information is commonly used for
- โข Host Registration
- โข Software Licensing
- โข CMDB Asset Unique Identification
๐งฉ 8. One-Key Information Collection Script
๐ฆ The following script can automatically collect key system information
#!/bin/bash
echo"==== Basic Information ===="
cat /sys/class/dmi/id/{sys_vendor,product_name,product_serial} 2>/dev/null
echo"==== CPU ===="
lscpu | grep -E 'Model name|Socket|Thread|Core|Vendor|Flags'
echo"==== Disk ===="
lsblk -o NAME,SIZE,ROTA,MODEL,SERIAL | grep -v loop
echo"==== Memory ===="
dmidecode -t memory | grep -E 'Size|Locator|Type|Speed' | grep -v "No Module Installed"
echo"==== Network Card ===="
ip -br link
echo"==== System ===="
cat /etc/os-release | grep PRETTY_NAME
uname -r
cat /etc/machine-id
More exciting content!