本次由於需要搭建一套環境,但是所需硬件配置不足,需要進行統計采購。那么就需要得知服務器現有配置,所以這次會介紹些常用的命令和工具來查詢硬件信息。其實也可以通過像DELL廠商的IDRAC控制台來獲取這些信息,但是比較尷尬的是IBM在獲取硬盤信息方面支持比較差,僅顯示物理磁盤數量,能夠獲取的信息很少,這時就需要像storcli這種專業工具來收集。本章使用的命令查詢需求比較單一,后續會在實際使用中慢慢補充上來。
一、查看服務器對應 IPMI 地址
[root@node-1 ~]# ipmitool lan print
Set in Progress : Set Complete
Auth Type Support : NONE MD2 MD5 PASSWORD
Auth Type Enable : Callback :
: User : MD2 MD5 PASSWORD
: Operator : MD2 MD5 PASSWORD
: Admin : MD2 MD5 PASSWORD
: OEM :
IP Address Source : Static Address
IP Address : 10.100.0.40
Subnet Mask : 255.255.255.0
MAC Address : 40:f2:e9:da:53:fe
SNMP Community String : public
IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
Gratituous ARP Intrvl : 2.0 seconds
Default Gateway IP : 10.100.0.1
Default Gateway MAC : 00:00:00:00:00:00
Backup Gateway IP : 0.0.0.0
Backup Gateway MAC : 00:00:00:00:00:00
802.1q VLAN ID : Disabled
802.1q VLAN Priority : 0
RMCP+ Cipher Suites : 1,2,3,4,5,6,7,8,9,10,11,12,13,14
Cipher Suite Priv Max : aaaaaaaaaaaaaaX
: X=Cipher Suite Unused
: c=CALLBACK
: u=USER
: o=OPERATOR
: a=ADMIN
: O=OEM
二、查看網卡速率
[root@node-1 ~]# lspci | grep Ethernet #列出每個pci總線上的設備,通過grep過濾可得到網卡設備列表,這里看到總計8個網卡
06:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
06:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
06:00.2 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
06:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
11:00.0 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)
11:00.1 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)
20:00.0 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)
20:00.1 Ethernet controller: Broadcom Limited NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)
[root@node-1 ~]# ethtool eth0 #查看單塊網卡的詳細信息
Settings for eth0:
Supported ports: [ TP ] #TP 代表是千兆網卡
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: on (auto)
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
[root@node-1 ~]# ethtool eth1
Settings for eth1:
Supported ports: [ FIBRE ] #FIBRE 代表是萬兆網卡
Supported link modes: 1000baseT/Full
10000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: No
Advertised link modes: 10000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: Unknown!
Duplex: Unknown! (255)
Port: FIBRE
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
Wake-on: d
Current message level: 0x00000000 (0)
Link detected: no
三、查看內存信息
[root@node-1 ~]# cat /proc/meminfo
[root@node-1 ~]# dmidecode -t memory #此命令會列出每條內存的型號、頻率等詳細信息
Handle 0x000A, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0009
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: DIMM
Set: 1
Locator: DIMM 1
Bank Locator: Bank 1
Type: DDR3
Type Detail: Registered (Buffered)
Speed: 1333 MHz
Manufacturer: Samsung
Serial Number: 3386DA95
Asset Tag: Unknown
Part Number: M393B1K70DH0-YH9
Rank: 2
Configured Clock Speed: 1333 MHz
四、使用 storcli 查看服務器硬件基礎信息
[root@node-1 ~]# rpm -ivh storcli-1.18.05-1.noarch.rpm #安裝包請見文章末尾
[root@node-1 ~]# /opt/MegaRAID/storcli/storcli64 show all #查詢所有信息並show,在system overview下看到controller(縮寫ctl)列數字就是controller號,得知node-1這台機器的controller號是0
System Overview :
===============
---------------------------------------------------------------------------
Ctl Model Ports PDs DGs DNOpt VDs VNOpt BBU sPR DS EHS ASOs Hlth
---------------------------------------------------------------------------
0 ServeRAIDM5110e 8 7 5 0 5 0 Opt On - Y 3 Opt
---------------------------------------------------------------------------
[root@node-1 ~]# /opt/MegaRAID/storcli/storcli64 /c0 show #顯示contrller0的raid卡的版本、功能、狀態、以及raid卡下的物理磁、邏輯盤信息,這里我需要看物理磁盤的容量情況,可以在PD LIST部分找到
如果不需要其他信息,和我一樣只需要知道物理磁盤信息的話可以使用如下命令
[root@node-1 ~]# /opt/MegaRAID/storcli/storcli64 /c0/eall/sall show
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp
-------------------------------------------------------------------------
252:0 20 Onln 1 278.464 GB SAS HDD N N 512B MK3001GRRB U
252:1 15 Onln 1 278.464 GB SAS HDD N N 512B ST9300603SS F U
252:2 16 Onln 0 557.861 GB SAS HDD N N 512B MBF2600RC U
252:3 17 Onln 0 557.861 GB SAS HDD N N 512B MBF2600RC U
252:4 19 Onln 2 557.861 GB SAS HDD N N 512B MBF2600RC U
252:5 14 Onln 3 557.861 GB SAS HDD N N 512B MBF2600RC U
252:6 18 Onln 4 557.861 GB SAS HDD N N 512B MBF2600RC U
-------------------------------------------------------------------------
五、不想安裝 storcli 的情況下查看硬盤型號信息
[root@node-1 ~]# cat /proc/scsi/scsi|grep 'Model:' #node-1 是 IBM X3650 M4
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM Model: ServeRAID M5110e Rev: 3.34
Vendor: IBM SATA Model: DEVICE 81Y3682 Rev: D001
[root@node-5 ~]# cat /proc/scsi/scsi|grep 'Model:' #node-5 是 DELL R720,ST1000NM0023就是硬盤的型號
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0D
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0D
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0F
Vendor: SEAGATE Model: ST1000NM0023 Rev: GS0D
這種方式在硬盤做 raid 后不便於查看,例如下面查看我另一台服務器所看到到的,顯示只有一塊磁盤設備
[root@node-1 ~]# cat /proc/scsi/scsi|grep 'Model:'
Vendor: DELL Model: PERC H710 Rev: 3.13
Vendor: TSSTcorp Model: DVD-ROM SN-108FB Rev: D150
接下來通過 lsblk 查看設備情況,發現這塊盤總容量2.7T(我這里使用的盤是1T的SAS盤,可以倒推出是4塊1T盤組成的raid5)正好對應上我在IDRAC界面中看到的四塊物理磁盤
[root@node-1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 24M 0 part
├─sda2 8:2 0 200M 0 part
├─sda3 8:3 0 250M 0 part /boot
├─sda4 8:4 0 1.4T 0 part
│ ├─os-root 253:0 0 1.4T 0 lvm /
│ └─os-swap 253:1 0 32G 0 lvm [SWAP]
└─sda5 8:5 0 1.3T 0 part
└─mongo-mongodb 253:2 0 1.3T 0 lvm /var/lib/mongo
sr0 11:0 1 1024M 0 rom


storcli安裝包各平台百度網盤鏈接地址(可在官網下載 https://www.broadcom.com/site-search?q=storcli)
鏈接:https://pan.baidu.com/s/19liM1WMaY7XoNIHLrX1dKg
提取碼:pu7n
續:在檢查過程中發現IBM服務器上有兩塊disk告警,聯系維保需要提供FRU號,但是人又不在現場沒辦法拔盤拍照。所以需要通過storcli來查詢盤對應FRU號。
六、查詢硬盤FRU號
[root@node-2 ~]# /opt/MegaRAID/storcli/storcli64 -PDList -aAll | grep FRU #如果想查看具體信息可以去掉過濾條件
IBM FRU/CRU: 42D0638
IBM FRU/CRU: 49Y2023
IBM FRU/CRU: 49Y2004
IBM FRU/CRU: 49Y2023
IBM FRU/CRU: 49Y2004
IBM FRU/CRU: 49Y2023
從上可以看到有兩對重復的FRU號,懷疑可能是組成raid,那么就要通過storcli查看下硬盤raid情況
(1)查看邏輯磁盤
[root@node-2 ~]# /opt/MegaRAID/storcli/storcli64 /c0/vall show #這里看到有5塊邏輯磁盤,通過 /c0 show 命令查看物理磁盤發現有6塊,繼續向下查看硬盤 raid 情況。
Controller = 0
Status = Success
Description = None
Virtual Drives :
==============
----------------------------------------------------------------------
DG/VD TYPE State Access Consist Cache Cac sCC Size Name
----------------------------------------------------------------------
0/0 RAID1 Optl RW Yes RWBD - ON 557.861 GB
1/1 RAID0 Optl RW Yes RWBD - ON 557.861 GB
2/2 RAID0 Optl RW Yes RWBD - ON 557.861 GB
3/3 RAID0 Optl RW Yes RWBD - ON 557.861 GB
4/4 RAID0 Optl RW Yes RWBD - ON 278.464 GB GenericR0_4
----------------------------------------------------------------------
Cac=CacheCade|Rec=Recovery|OfLn=OffLine|Pdgd=Partially Degraded|dgrd=Degraded
Optl=Optimal|RO=Read Only|RW=Read Write|HD=Hidden|TRANS=TransportReady|B=Blocked|
Consist=ConsistentR=Read Ahead Always|NR=No Read Ahead|WB=WriteBack|
AWB=Always WriteBack|WT=WriteThrough|C=Cached IO|D=Direct IO|sCC=Scheduled
Check Consistency
(2)查看邏輯磁盤大小、raid結構
[root@node-2 ~]# /opt/MegaRAID/storcli/storcli64 /c0/v0 show #可以看到 TYPE 為 RAID1,兩塊 600G 盤做的 RAID1,正好能夠對上6塊物理磁盤
Controller = 0
Status = Success
Description = None
Virtual Drives :
==============
---------------------------------------------------------------
DG/VD TYPE State Access Consist Cache Cac sCC Size Name
---------------------------------------------------------------
0/0 RAID1 Optl RW Yes RWBD - ON 557.861 GB
---------------------------------------------------------------
Cac=CacheCade|Rec=Recovery|OfLn=OffLine|Pdgd=Partially Degraded|dgrd=Degraded
Optl=Optimal|RO=Read Only|RW=Read Write|HD=Hidden|TRANS=TransportReady|B=Blocked|
Consist=ConsistentR=Read Ahead Always|NR=No Read Ahead|WB=WriteBack|
AWB=Always WriteBack|WT=WriteThrough|C=Cached IO|D=Direct IO|sCC=Scheduled
Check Consistency
[root@node-2 ~]# /opt/MegaRAID/storcli/storcli64 /c0/v1 show #可以看到 TYPE 為 RAID0
Controller = 0
Status = Success
Description = None
Virtual Drives :
==============
---------------------------------------------------------------
DG/VD TYPE State Access Consist Cache Cac sCC Size Name
---------------------------------------------------------------
1/1 RAID0 Optl RW Yes RWBD - ON 557.861 GB
---------------------------------------------------------------
Cac=CacheCade|Rec=Recovery|OfLn=OffLine|Pdgd=Partially Degraded|dgrd=Degraded
Optl=Optimal|RO=Read Only|RW=Read Write|HD=Hidden|TRANS=TransportReady|B=Blocked|
Consist=ConsistentR=Read Ahead Always|NR=No Read Ahead|WB=WriteBack|
AWB=Always WriteBack|WT=WriteThrough|C=Cached IO|D=Direct IO|sCC=Scheduled
Check Consistency
依次查看 /c0/v0……4,結果為 v0 raid1 其余四個邏輯磁盤均為 raid0
