在Linux上查询物理机信息-不用去拆机器了

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

在Linux上查询物理机信息-不用去拆机器了

自由早晚乱余生   2020-03-14 我要评论
[toc] 最近需要因为公司需要,需要查询公司物理机的信息,整个整理下来,总结了这么一篇文章,欢迎大家补充。 在 `Linux` 系统获取物理机器的信息: 我们可以通过 `lshw` 或者 `dmidecode` 来获取服务器对应的物理机信息。 我们这里还是推荐使用 `dmidecode` 来获取。 安装 `dmidecode` ``` yum install -y dmidecode ``` ## 一、查看系统信息(包含机器型号) ### 1.1 查看机型和品牌 ```shell [root@djx ~]# dmidecode --type system # dmidecode 3.1 Getting SMBIOS data from sysfs. SMBIOS 3.2.0 present. # SMBIOS implementations newer than version 3.1.1 are not # fully supported by this version of dmidecode. Handle 0x0100, DMI type 1, 27 bytes System Information Manufacturer: Dell Inc. # 机器品牌 Product Name: PowerEdge R740 # 机器型号 Version: Not Specified Serial Number: FW89BX2 UUID: 4c4c4534-0057-3810-8019-c6c04f425832 Wake-up Type: Power Switch SKU Number: SKU=NotProvided;ModelName=PowerEdge R740 Family: PowerEdge #直接获取机型和品牌 dmidecode --type system |grep -E 'Manufacturer|Product Name' #lshw|head #可以获取物理机机器型号和 ``` ## 二、查看CPU 信息 ### 2.1 查看CPU 型号 > 也可以使用 `cat /proc/cpuinfo |grep "model name"|head -1` ```shell [root@djx ~]# dmidecode --type processor # dmidecode 3.1 Getting SMBIOS data from sysfs. SMBIOS 3.2.0 present. # SMBIOS implementations newer than version 3.1.1 are not # fully supported by this version of dmidecode. Handle 0x0400, DMI type 4, 48 bytes Processor Information Socket Designation: CPU1 Type: Central Processor Family: Xeon Manufacturer: Intel ID: 57 06 04 00 FF F5 EB BF Signature: Type 0, Family 6, Model 85, Stepping 7 Flags: FPU (Floating-point unit on-chip) VME (Virtual mode extension) DE (Debugging extension) PSE (Page size extension) TSC (Time stamp counter) MSR (Model specific registers) PAE (Physical address extension) MCE (Machine check exception) CX8 (CMPXCHG8 instruction supported) APIC (On-chip APIC hardware supported) SEP (Fast system call) MTRR (Memory type range registers) PGE (Page global enable) MCA (Machine check architecture) CMOV (Conditional move instruction supported) PAT (Page attribute table) PSE-36 (36-bit page size extension) CLFSH (CLFLUSH instruction supported) DS (Debug store) ACPI (ACPI supported) MMX (MMX technology supported) FXSR (FXSAVE and FXSTOR instructions supported) SSE (Streaming SIMD extensions) SSE2 (Streaming SIMD extensions 2) SS (Self-snoop) HTT (Multi-threading) TM (Thermal monitor supported) PBE (Pending break enabled) Version: Intel(R) Xeon(R) Silver 4208 CPU @ 2.10GHz # CPU 型号 Voltage: 1.8 V External Clock: 9600 MHz Max Speed: 4000 MHz Current Speed: 2100 MHz Status: Populated, Enabled Upgrade: Socket LGA2011 L1 Cache Handle: 0x0700 L2 Cache Handle: 0x0701 L3 Cache Handle: 0x0702 Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Core Count: 8 Core Enabled: 8 Thread Count: 16 Characteristics: 64-bit capable Multi-Core Hardware Thread Execute Protection Enhanced Virtualization Power/Performance Control Handle 0x0401, DMI type 4, 48 bytes Processor Information Socket Designation: CPU2 Type: Central Processor Family: Unknown Manufacturer: Not Specified ID: 00 00 00 00 00 00 00 00 Version: Not Specified Voltage: Unknown External Clock: Unknown Max Speed: 4000 MHz Current Speed: Unknown Status: Unpopulated Upgrade: Socket LGA2011 L1 Cache Handle: Not Provided L2 Cache Handle: Not Provided L3 Cache Handle: Not Provided Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Characteristics: None # dmidecode --type processor |grep 'Version' ``` ### 2.2 查看CPU的物理数量 ```shell cat /proc/cpuinfo |grep "physical id"|sort|uniq|wc -l ``` ### 2.3 查看 CPU核心数量(非逻辑CPU) ```shell grep "cpu cores" /proc/cpuinfo | uniq | awk -F ":" "{print $2}" ``` ### 2.4 查看 CPU数量(逻辑) ```shell cat /proc/cpuinfo |grep 'processor'|wc -l ``` ### 2.5 查看CPU的支持的最大内存 ``` 我这个没有找到,可以从 cpu 型号进行查询。 直接百度搜索该CPU信息,然后查看该 cpu 的参数。 ``` ## 三、查询主板信息 ### 3.1 查询主板型号 ```shell [root@djx ~]# dmidecode --type baseboard|head # dmidecode 3.1 Getting SMBIOS data from sysfs. SMBIOS 3.2.0 present. # SMBIOS implementations newer than version 3.1.1 are not # fully supported by this version of dmidecode. Handle 0x0200, DMI type 2, 8 bytes Base Board Information Manufacturer: Dell Inc. # 主板品牌 Product Name: 014X06 # 生产号 ``` ### 3.2 查看主板可以支持的最大内存 ```shell dmidecode |grep "Maximum Capacity" / dmidecode --type memory |head ``` ## 四、查询磁盘相关的东西 ### 4.1 磁盘大小 ```shell fdisk -l ``` ### 4.2 磁盘块数 ```shell fdisk -l # 这个也不精确,建议直接去物理机上面看,我们下面提供戴尔服务器如何查询的方法。 ``` ### 4.3 是否启用raid ```shell lspci |grep -i raid # 这个不精确 建议安装特定的软件(不同机器不一样)进行查看 ``` ### 4.4 查看当前的 raid版本 ``` 要根据官方的文档去安装驱动进行查询。 ``` ## 五、查询内存条信息 ### 5.1 当前内存单条大小 ```shell dmidecode --type memory |grep "Size" ``` #### 当前多少根内存条 ```shell dmidecode --type memory |grep "Size"|grep 'MB'|wc -l ``` #### 当前内存条型号 ```shell dmidecode --type memory |grep "Part Number" ``` #### 可以扩展内存条数目 ```shell dmidecode --type memory |grep "Number Of Devices" # 这个数据也是仅仅供参考,因为 部分服务器,单物理CPU 是可以插8根内存条,然后2个物理CPU是可以插12根内存条的,这个需要查看服务器的官方文档。 ``` #### 可以扩展内存总大小 ```shell dmidecode |grep "Maximum Capacity" # 这个值也不是很准,跟内存条的类型与插入的内存条有关。 建议查询官方文档 ``` ## 六、 扩展 ### 6.1 扩展信息 戴尔如何获取服务码:机器前面显示屏的字符串(7位)/或者快速服务代码。 惠普如何获取服务码: 机器上的SN 码 。HP 查询是否过保网站: https://support.hpe.com/hpsc/wc/public/home 戴尔监控物理设备一般使用的是 `IDRAC` (远程)及 `OMSA` 、 `SAE` #### 内存条类型区分 内存条类型分为 `LRDIMM`、`RDIMM`、`UDIMM`,一般来说`LRDIMM` 的内存条容量更大些。同一个机型,我们建议使用相同类型的内存条。一般只只有颗CPU的话,只能支持一半的内存条数。如何查询内存条的安装方法以及服务器支持的最大内存。我们一般从官方文档查询, 一般位于官方文档中的用户手册,技术规格-[内存规格](https://www.dell.com/support/manuals/cn/zh/cndhs1/poweredge-r740/per740_ism_pub/%E5%86%85%E5%AD%98%E8%A7%84%E6%A0%BC?guid=guid-57fb973a-4069-4f40-894f-8a0e277279e8&lang=zh-cn) ,安装方法为 安装文档里面[内存内容]( [https://www.dell.com/support/manuals/cn/zh/cndhs1/poweredge-r740/per740_ism_pub/%E7%B3%BB%E7%BB%9F%E5%86%85%E5%AD%98%E6%8C%87%E5%8D%97?guid=guid-35e102bf-db9e-4652-a16b-2b37f8fce553&lang=zh-cn](https://www.dell.com/support/manuals/cn/zh/cndhs1/poweredge-r740/per740_ism_pub/系统内存指南?guid=guid-35e102bf-db9e-4652-a16b-2b37f8fce553&lang=zh-cn) ) ### 6.2 戴尔服务器查询是否使用了 raid 需要安装 `PERC`,[官方文档](https://www.dell.com/support/article/zh-cn/sln283135/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8poweredge-raid%E6%8E%A7%E5%88%B6%E5%99%A8-perc-%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%95%8C%E9%9D%A2-cli-%E5%AE%9E%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%AE%A1%E7%90%86raid%E6%8E%A7%E5%88%B6%E5%99%A8?lang=zh)。 从戴尔支持站点下载[Linux PERCCLI实用程序](https://www.dell.com/support/home)。选择您的系统,然后按类别**SAS RAID**或通过使用关键字**PERCCLI**筛选驱动程序和下载 ```shell # 查看是否使用了raid,raid几 perccli /c0/v0 show all ``` ```shell # 查看物理磁盘数 perccli /c0/eall/sall show ```

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们