Linux工具:物理信息【dmidecode】

4/25/2022 运维操作系统Linux

Linux 系统,推荐使用 dmidecode 来获取服务器对应的物理机信息。

安装 dmidecode

yum install -y dmidecode
1

# 一、查看CPU 信息

# CPU 型号

dmidecode --type processor
1

# CPU的物理数量

cat  /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l
1

# CPU核心数量(非逻辑CPU)

grep "cpu cores" /proc/cpuinfo | uniq | awk -F ":" "{print $2}"
1

# CPU数量(逻辑)

cat  /proc/cpuinfo |grep \'processor\'|wc -l
1

# 二、查询内存条信息

# 内存大小

dmidecode|grep Size
1

# 内存单条大小

dmidecode --type memory |grep "Size"
1

# 内存速率

dmidecode|grep Speed
1

# 内存类型

dmidecode|grep DDR
1

# 内存条型号

dmidecode --type memory |grep "Part Number"
1

# 可扩展内存条数目

dmidecode --type memory |grep "Number Of Devices"
1

仅供参考,因为部分服务器,单物理CPU 是可以插8根内存条,然后2个物理CPU是可以插12根内存条的。建议查询官方文档

# 可扩展内存总大小

dmidecode |grep "Maximum Capacity"
1

仅供参考,跟内存条的类型与插入的内存条有关。 建议查询官方文档

# ECC内存

ECC (error-correcting code) RAM is essential in servers and many workstations as it dramatically improves the reliability of the system's memory by detecting common kinds of data corruption and fixing the errors automatically. Without the error correction of ECC memory, memory errors can cause data corruption or even blue screens.

命令

dmidecode -t memory
1

输出

Handle 0x003D, DMI type 17, 27 bytes
Memory Device
        Array Handle: 0x003B
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 64 bits
        Size: 2048 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM_A1
        Bank Locator: NODE 0 CHANNEL 0 DIMM 0
        Type: Other
        Type Detail: Synchronous
        Speed: 1067 MHz
        Manufacturer: 0x80CE
        Serial Number: 0x875802AD
        Asset Tag: Unknown
        Part Number: M393B5673FH0-CH9  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

注意,如果信息包含Error Information Handle: Not Provided,Total Width: 72 bits, Data Width: 64 bits则表明ecc是启动的。

# 三、查询主板信息

# 主板型号

dmidecode --type baseboard|head
1

# 主板可以支持的最大内存

dmidecode |grep "Maximum Capacity"
1

或者

dmidecode --type memory |head
1

# 四、查询磁盘信息

fdisk  -l
1

# 五、查看机型和品牌

dmidecode  --type system
1
上次更新时间: 9/25/2024, 1:19:15 AM