Linux系统查看服务器硬件信息
1、查看服务器型号
1 [root@localhost ~]# dmidecode | grep "Product" 2 Product Name: RH2288H V3 3 Product Name: BC11H****
2、查看服务器的序列号
1 [root@localhost ~]# dmidecode -t system | grep 'Serial Number' 2 Serial Number: 2102311QGG10********
3、统一查看服务器SN序列号和型号
1 [root@localhost ~]# dmidecode | grep "System Information" -A9 | egrep "Manufacturer|Product|Serial" 2 Manufacturer: Huawei 3 Product Name: RH2288H V3 4 Serial Number: 2102311QGG10********
4、查看CPU信息
备注:两种方法lscpu可以查看CPU的完整信息或者cat /proc/cpuinfo
[root@localhost ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 16 On-line CPU(s) list: 0-15 Thread(s) per core: 1 Core(s) per socket: 8 座: 2 NUMA 节点: 2 厂商 ID: GenuineIntel CPU 系列: 6 型号: 79 型号名称: Intel(R) Xeon(R) CPU E5-2609 v4 @ 1.70GHz ******************************************
5、查看GPU显卡信息
通过$ nvidia-smi -q
查看BUS-ID和显卡的序列号之间的对应关系
[root@localhost ~]# nvidia-smi -q ==============NVSMI LOG============== Timestamp : Wed May 24 16:29:21 2023 Driver Version : 525.89.02 CUDA Version : 12.0 Attached GPUs : 7 GPU 00000000:34:00.0 Product Name : NVIDIA RTX A5000 Product Brand : NVIDIA RTX Product Architecture : Ampere Display Mode : Disabled Display Active : Disabled Persistence Mode : Disabled MIG Mode Current : N/A Pending : N/A **************************************
信息很多,再往下拉可以看到显卡的BUS-ID 信息和相对应的序列号(Serial Number)。那这张显卡插在哪个PCIE卡槽?
通过dmidecode -t slot
查看BUS-ID (BUS Address)和卡槽的对应关系:
[root@localhost ~]# dmidecode -t slot # dmidecode 3.2 Getting SMBIOS data from sysfs. SMBIOS 3.3.0 present. # SMBIOS implementations newer than version 3.2.0 are not # fully supported by this version of dmidecode. Handle 0x0025, DMI type 9, 17 bytes System Slot Information Designation: CPU0_PE1_SLOT3 Type: x16 <OUT OF SPEC> Current Usage: In Use Length: Long Characteristics: 3.3 V is provided Opening is shared PME signal is supported Bus Address: 0000:34:00.0
可以看到BUS对应的卡槽为SLOT3,SLOT标号一般在主板上,白色字体,在每个PCIE插槽(很长的那个插槽,插显卡的)的上方。
还可以通过 dmidecode -t slot | egrep -i "slot|add"
查看 (输出更简洁),输出类似于:
[root@localhost ~]# dmidecode -t slot | egrep -i "slot|add" System Slot Information Bus Address: 0000:33:00.0 System Slot Information Designation: CPU0_PE1_SLOT3 Bus Address: 0000:34:00.0 System Slot Information Designation: CPU0_PE1_SLOT2 Bus Address: 0000:35:00.0 System Slot Information Designation: CPU0_PE1_SLOT1 Bus Address: 0000:36:00.0 System Slot Information Designation: CPU0_PE1_SLOT0 Bus Address: 0000:37:00.0 System Slot Information Bus Address: 0000:4b:00.0 System Slot Information Bus Address: 0000:65:00.0 System Slot Information Bus Address: 0000:9a:00.0 System Slot Information Designation: CPU1_PE0_SLOT7 Bus Address: 0000:9b:00.0 System Slot Information Designation: CPU1_PE0_SLOT6 Bus Address: 0000:9c:00.0 System Slot Information Designation: CPU1_PE0_SLOT5 Bus Address: 0000:9d:00.0 System Slot Information Designation: CPU1_PE0_SLOT4 Bus Address: 0000:9e:00.0
直接查看显卡SN序列号:
[root@localhost ~]# nvidia-smi -q | grep 'Serial Number' Serial Number : 13217220***** Serial Number : 13217220***** Serial Number : 13217220***** Serial Number : 13217220***** Serial Number : 13217220***** Serial Number : 13217220***** Serial Number : 13217220***** Serial Number : 13217220*****
6、查看硬盘信息
1、用“df -h”命令;2、用“lsblk”命令;3、用“sudo lshw -class disk”命令;4、用“fdisk -l”命令;5、用“cat /proc/partitions”命令;6、用“lsscsi”命令
7、查看内存插槽信息及使用情况
1 [root@localhost ~]# dmidecode -t memory | grep Size 2 Size: 8192 MB 3 Size: 8192 MB 4 Size: 16384 MB 5 Size: 16384 MB 6 Size: No Module Installed 7 Size: No Module Installed
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!