linux命令--查看硬盘信息(磁盘阵列模式下)

如果服务器有做磁盘阵列,那么运行fdisk -l或者smartctl –all /dev/sda,得不到你要的磁盘信息。

[root@localhost /]# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sda: 599.6 GB, 599584145408 bytes
255 heads, 63 sectors/track, 72895 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000aadb9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       72896   585531391+  ee  GPT
Partition 1 does not start on physical sector boundary.

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 1999.3 GB, 1999307276288 bytes
255 heads, 63 sectors/track, 243068 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243069  1952448511+  ee  GPT
Partition 1 does not start on physical sector boundary.
[root@localhost /]# smartctl --all /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-358.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

Vendor:               LSI
Product:              MR9260-8i
Revision:             2.13
User Capacity:        599,584,145,408 bytes [599 GB]
Logical block size:   512 bytes
Logical Unit id:      0x600605b00585ee301e70629e1af12036
Serial number:        003620f11a9e62701e30ee8505b00506
Device type:          disk
Local Time is:        Thu May  5 05:26:19 2016 EDT
Device does not support SMART

Error Counter logging not supported
Device does not support Self Test logging

可以借助MegaClI命令,MegaClI命令系统不自带,需要额外下载

下载地址,搜索MegaCLI即可找到:

http://www.avagotech.com/support/download-search

我下载到/root/usr/local目录下

[root@localhost local]# ls
8-07-10_MegaCLI_Linux.zip  etc    include  lib64    sbin   src
bin                        games  lib      libexec  share

然后解压

[root@localhost local]# unzip 8-07-10_MegaCLI_Linux.zip
Archive:  8-07-10_MegaCLI_Linux.zip
  inflating: 8.07.10_MegaCLI_Linux/Linux MegaCLI 8.07.10.txt  
   creating: 8.07.10_MegaCLI_Linux/Linux MegaCLI 8.07.10/
  inflating: 8.07.10_MegaCLI_Linux/Linux MegaCLI 8.07.10/MegaCli-8.07.10-1.noarch.rpm 

找到安装包

[root@localhost local]# ls
8.07.10_MegaCLI_Linux      bin  games    lib    libexec  share
8-07-10_MegaCLI_Linux.zip  etc  include  lib64  sbin     src
[root@localhost local]# cd 8.07.10_MegaCLI_Linux/
[root@localhost 8.07.10_MegaCLI_Linux]# ls -l
total 52
drwxr-xr-x. 2 root root  4096 Jun  6  2013 Linux MegaCLI 8.07.10
-rw-r--r--. 1 root root 47364 Jun  7  2013 Linux MegaCLI 8.07.10.txt
[root@localhost 8.07.10_MegaCLI_Linux]# cd Linux\ MegaCLI\ 8.07.10
Linux MegaCLI 8.07.10/     Linux MegaCLI 8.07.10.txt  
[root@localhost 8.07.10_MegaCLI_Linux]# cd Linux\ MegaCLI\ 8.07.10
[root@localhost Linux MegaCLI 8.07.10]# ls -l
total 1512
-rw-r--r--. 1 root root 1546999 May 28  2013 MegaCli-8.07.10-1.noarch.rpm

安装MegaCLI,默认安装在/opt下面,建立软链到/usr/bin

[root@localhost Linux MegaCLI 8.07.10]# rpm -ivh MegaCli-8.07.10-1.noarch.rpm 
Preparing...                ########################################### [100%]
   1:MegaCli                ########################################### [100%]
[root@localhost Linux MegaCLI 8.07.10]# ln -s /opt/MegaRAID/MegaCli/
install.log                 libstorelibir-2.so.14.07-0  
libstorelibir-2.so          MegaCli64                   
[root@localhost Linux MegaCLI 8.07.10]# ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/

安装完成,命令查看硬盘信息

[root@localhost Linux MegaCLI 8.07.10]# cd /usr/bin
[root@localhost bin]# /opt/MegaRAID/MegaCli/MegaCli64 -PDlist -aALL

Adapter #0

Enclosure Device ID: 252
Slot Number: 0
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 23
WWN: 5000C5007E156790
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS

Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]
Coerced Size: 558.406 GB [0x45cd0000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: 000B
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c5007e156791
SAS Address(1): 0x0
Connected Port Number: 1(path0) 
Inquiry Data: SEAGATE ST3600057SS     000B6SL9AQG9            
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :47C (116.60 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: Unknown 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 252
Slot Number: 1
Drive's position: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: N/A
Device Id: 22
WWN: 5000C5007E1F08A0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS

Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]
Coerced Size: 558.406 GB [0x45cd0000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: 000B
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c5007e1f08a1
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST3600057SS     000B6SL9BEFK            
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :48C (118.40 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: Unknown 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 252
Slot Number: 4
Drive's position: DiskGroup: 1, Span: 0, Arm: 0
Enclosure position: N/A
Device Id: 4
WWN: 5000c5003cbcbbaf
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA

Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: SN03
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x4433221104000000
Connected Port Number: 2(path0) 
Inquiry Data:             Z1N2ENH2ST1000NM0011                            SN03    
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :35C (95.00 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 252
Slot Number: 5
Drive's position: DiskGroup: 1, Span: 0, Arm: 1
Enclosure position: N/A
Device Id: 5
WWN: 5000c5003cbe2f17
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA

Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: SN03
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x4433221105000000
Connected Port Number: 5(path0) 
Inquiry Data:             Z1N0ZASWST1000NM0011                            SN03    
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :32C (89.60 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 252
Slot Number: 6
Drive's position: DiskGroup: 1, Span: 1, Arm: 0
Enclosure position: N/A
Device Id: 25
WWN: 5000c5003cbe2fb5
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA

Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: SN03
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x4433221106000000
Connected Port Number: 3(path0) 
Inquiry Data:             Z1N22ZGSST1000NM0011                            SN03    
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :33C (91.40 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 252
Slot Number: 7
Drive's position: DiskGroup: 1, Span: 1, Arm: 1
Enclosure position: N/A
Device Id: 24
WWN: 5000c5003cbe29c3
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA

Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Sector Size:  0
Logical Sector Size:  0
Physical Sector Size:  0
Firmware state: Online, Spun Up
Commissioned Spare : No
Emergency Spare : No
Device Firmware Level: SN03
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x4433221107000000
Connected Port Number: 4(path0) 
Inquiry Data:             Z1N070NTST1000NM0011                            SN03    
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive:  Not Certified
Drive Temperature :32C (89.60 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No




Exit Code: 0x00

从上面可以看出服务器有六块硬盘:

2块 SEAGATE ST3600057SS 600GB硬盘 4块 Z1N070NTST1000NM0011 1TB硬盘

MegaCli常用参数介绍
MegaCli -adpCount 【显示适配器个数】
MegaCli -AdpGetTime –aALL 【显示适配器时间】
MegaCli -AdpAllInfo -aAll 【显示所有适配器信息】
MegaCli -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
MegaCli -PDList -aAll 【显示所有的物理信息】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
MegaCli -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
MegaCli -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】

你可能感兴趣的:(linux,服务器,磁盘)