dmidecode命令详解(获取硬件信息)(2)

[root@SC4304 ~]# dmidecode -t 16
# dmidecode 2.11
# SMBIOS entry point at 0xb89a5000
SMBIOS 2.7 present.
 
Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: Multi-bit ECC
    Maximum Capacity: 1536 GB
    Error Information Handle: Not Provided
    Number Of Devices: 24

从上面的信息我们可以看出:

内存插槽数:24个

最大扩展内存:1536G

单跟内存条最大:64G

现在内存为:128G

但是,我们还必须查清这里的128G到底是16*8GB, 2*64GB还是其他?就是查看已使用的插槽数
如果是2*64GB,那么可以扩展到1536GB,但是如果插槽已经插满,无法扩展了:

1、查看内存槽数、哪个槽位插了内存,大小是多少

[root@SC4305 ~]# dmidecode|grep -A5 'Memory Device'|grep Size
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed

2、查看最大支持内存数

[root@SC4305 ~]# dmidecode|grep 'Maximum Capacity'
    Maximum Capacity: 1536 GB

3、查看槽位上内存的速率,没插就是unknown。

[root@SC4305 ~]# dmidecode|grep -A16 'Memory Device'|grep 'Speed'
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown

五、一个查看基本硬件信息的shell脚本

[root@SC4306 test]# cat test.sh
#!/bin/bash 
echo "IP:" 
ifconfig |grep "inet addr"|grep -v 127.0.0.1|awk '{print $2}'|awk -F ':' '{print $2}' 
echo "Product Name:" 
dmidecode |grep Name 
echo "CPU Info:" 
dmidecode |grep -i cpu|grep -i version|awk -F ':' '{print $2}' 
echo "Disk Info:" 
parted -l|grep 'Disk /dev/sd'|awk -F ',' '{print "  ",$1}' 
echo "Network Info:" 
lspci |grep Ethernet 
echo "Memory Info:" 
dmidecode|grep -A5 "Memory Device"|grep Size|grep -v No 
echo "Memory number:"`dmidecode|grep -A5 "Memory Device"|grep Size|grep -v No|wc -l`

输出结果:

[root@SC4306 test]# bash test.sh
IP:
10.0.17.6
10.0.250.6
Product Name:
    Product Name: PowerEdge R720
    SKU Number: SKU=NotProvided;ModelName=PowerEdge R720
    Product Name: 0DCWD1
CPU Info:
      Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
      Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
Disk Info:
    Disk /dev/sda: 1074GB
    Disk /dev/sdb: 18.9TB
Network Info:
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
01:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
02:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
Memory Info:
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
    Size: 16384 MB
Memory number:8

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15628.html