linux硬盘管理 raid

  服务器有部分硬盘报警 需要更换 刚接手服务器不知道具体情况  百度了一些教程 都不尽人意 查询结果都没有想要的 

后找到一篇文章 地址 http://blog.csdn.net/msdnchina/article/details/52475383 我这里只写与我实际操作有出入的地方 以备复习 
cat /proc/scsi/scsi 
dmesg | grep -i raid

lsi MegaRAID raid卡管理工具能查如下信息:
raid的level,
raid是几块物理硬盘构成的,
物理硬盘的制造商.

软件raid:查看raid级别,状态等信息
#cat /proc/mdstat
硬件raid:查看raid的厂商,型号,级别
#cat /proc/scsi/scsi
dmesg | grep -i raid

dracut: rd_NO_MD: removing MD RAID activation
megaraid_sas 0000:03:00.0: PCI INT A -> GSI 42 (level, low) -> IRQ 42
megaraid_sas 0000:03:00.0: setting latency timer to 64
megaraid_sas 0000:03:00.0: FW now in Ready state
megaraid_sas 0000:03:00.0: irq 107 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 108 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 109 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 110 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 111 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 112 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 113 for MSI/MSI-X
megaraid_sas 0000:03:00.0: irq 114 for MSI/MSI-X
megaraid_sas 0000:03:00.0: firmware supports msix    : (16)
megaraid_sas 0000:03:00.0: current msix/online cpus    : (8/8)
megaraid_sas 0000:03:00.0: RDPQ mode    : (disabled)
megaraid_sas 0000:03:00.0: Current firmware maximum commands: 1008     LDIO threshold: 0
megaraid_sas 0000:03:00.0: Init cmd success
megaraid_sas 0000:03:00.0: firmware type    : Legacy(64 VD) firmware
megaraid_sas 0000:03:00.0: controller type    : MR(512MB)
megaraid_sas 0000:03:00.0: Online Controller Reset(OCR)    : Enabled
megaraid_sas 0000:03:00.0: Secure JBOD support    : No
megaraid_sas 0000:03:00.0: INIT adapter done
megaraid_sas 0000:03:00.0: Jbod map is not supported megasas_setup_jbod_map 4967
megaraid_sas 0000:03:00.0: pci id        : (0x1000)/(0x005b)/(0x1028)/(0x1f38)
megaraid_sas 0000:03:00.0: unevenspan support    : no
megaraid_sas 0000:03:00.0: firmware crash dump    : no
megaraid_sas 0000:03:00.0: jbod sync map        : no
scsi0 : Avago SAS based MegaRAID driver
megaraid_sas 0000:03:00.0: scanning for scsi0...
megaraid_sas 0000:03:00.0: 4145 (529973269s/0x0001/CRIT) - VD 00/0 is now DEGRADED
megaraid_sas 0000:03:00.0: scanning for scsi0...
软件下载地址http://www.avagotech.com/support/download-search

在搜索框里搜索"megacli",点击确定,找到Management Software and Tools (22) 下的 MegaCLI 5.5 P2  (这是命令行工具),另:lsi已经被avago收购了.

[root@F11 ~]# mv 8-07-14_MegaCLI.zip 123/
[root@F11 ~]# cd 123/
[root@F11 123]# unzip 8-07-14_MegaCLI.zip 
Archive:  8-07-14_MegaCLI.zip
  inflating: 8.07.14_MegaCLI.txt     
  inflating: DOS/MegaCLI.exe         
 extracting: FreeBSD/MegaCLI.zip     
 extracting: FreeBSD/MegaCli64.zip   
  inflating: Linux/MegaCli-8.07.14-1.noarch.rpm  
  inflating: Solaris/MegaCli.pkg     
  inflating: Windows/MegaCli.exe     
  inflating: Windows/MegaCli64.exe   
[root@F11 123]# ls -lrt
total 7824
-rw-r--r-- 1 root root   48298 Jan 19  2014 8.07.14_MegaCLI.txt
-rw-r--r-- 1 root root 7939395 Dec  8 10:34 8-07-14_MegaCLI.zip
drwxr-xr-x 2 root root    4096 Dec  8 10:36 DOS
drwxr-xr-x 2 root root    4096 Dec  8 10:36 FreeBSD
drwxr-xr-x 2 root root    4096 Dec  8 10:36 Linux
drwxr-xr-x 2 root root    4096 Dec  8 10:36 Solaris
drwxr-xr-x 2 root root    4096 Dec  8 10:36 Windows
[root@F11 123]# cd Linux/
[root@F11 Linux]# LS -L
-bash: LS: command not found
[root@F11 Linux]# ls -l
total 1516
-rw-r--r-- 1 root root 1549650 Dec 16  2013 MegaCli-8.07.14-1.noarch.rpm
[root@F11 Linux]# rpm -ivh MegaCli-8.07.14-1.noarch.rpm 
Preparing...                ########################################### [100%]
   1:MegaCli                ########################################### [100%]
[root@F11 Linux]# cd /opt/MegaRAID/MegaCli/ 
[root@F11 MegaCli]# ls -l
total 3188
-rw-r--r-- 1 root root       0 Dec  8 10:37 install.log
lrwxrwxrwx 1 root root      48 Dec  8 10:37 libstorelibir-2.so -> /opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0
-rwx------ 1 root root  540512 Dec 16  2013 libstorelibir-2.so.14.07-0
-rwxr-xr-x 1 root root 2720320 Dec 16  2013 MegaCli64

以下是MegaCli使用命令

  1. 命令使用:  
  2. #/opt/MegaCli  -LDInfo -Lall -aALL 查raid级别  
  3. #/opt/MegaCli -AdpAllInfo -aALL 查raid卡信息  
  4. #/opt/MegaCli -PDList -aALL 查看硬盘信息  
  5. #/opt/MegaCli -AdpBbuCmd -aAll 查看电池信息  
  6. #/opt/MegaCli -FwTermLog -Dsply -aALL 查看raid卡日志  
  7. #/opt/MegaCli -adpCount 【显示适配器个数】  
  8. #/opt/MegaCli -AdpGetTime –aALL 【显示适配器时间】  
  9. #/opt/MegaCli -AdpAllInfo -aAll    【显示所有适配器信息】  
  10. #/opt/MegaCli -LDInfo -LALL -aAll    【显示所有逻辑磁盘组信息】  
  11. #/opt/MegaCli -PDList -aAll    【显示所有的物理信息】  
  12. #/opt/MegaCli -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】  
  13. #/opt/MegaCli -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】  
  14. #/opt/MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】  
  15. #/opt/MegaCli -AdpBbuCmd -GetBbuDesignInfo -aALL    【显示BBU设计参数】  
  16. #/opt/MegaCli -AdpBbuCmd -GetBbuProperties -aALL    【显示当前BBU属性】  
  17. #/opt/MegaCli -cfgdsply -aALL    【显示Raid卡型号,Raid设置,Disk相关信息】 

[root@F11 MegaCli]# ./MegaCli64 -PDList -aALL  
                                     
Adapter #0

Enclosure Device ID: 32
Slot Number: 0
Enclosure position: 1
Device Id: 0
WWN: 5000CCA03EC7F6AB
Sequence Number: 4
Media Error Count: 4
Other Error Count: 9

这两个数值来确定阵列中磁盘是否有问题;Medai Error Count 表示磁盘可能错误,可能是磁盘有坏道,这个值不为0值得注意,数值越大,危险系数越高,Other Error Count 表示磁盘可能存在松动,可能需要重新再插入。MegaCli 可以对阵列中所有的磁盘进行检测,我们可以通过脚本的方式来检测相关参数,从而通知管理人员。
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS

扫描二维码关注公众号,回复: 191627 查看本文章

Raw Size: 2.728 TB [0x15d50a3b0 Sectors]
Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors]
Coerced Size: 2.728 TB [0x15d400000 Sectors]
Sector Size:  0
Firmware state: Unconfigured(bad)
Device Firmware Level: M440
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000cca03ec7f6a9
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: HITACHI HUS723030ALS640 M440YVKJZ4YK            
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 Temperature :38C (100.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: 32
Slot Number: 1
Drive's position: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 1
Device Id: 1
WWN: 5000CCA03EC56C53
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: 2.728 TB [0x15d50a3b0 Sectors]
Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors]
Coerced Size: 2.728 TB [0x15d400000 Sectors]
Sector Size:  0
Firmware state: Online, Spun Up
Device Firmware Level: M440
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000cca03ec56c51
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: HITACHI HUS723030ALS640 M440YVKHKV9K            
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 Temperature :38C (100.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: 32
Slot Number: 2
Drive's position: DiskGroup: 0, Span: 0, Arm: 2
Enclosure position: 1
Device Id: 2
WWN: 5000CCA03EC7659B
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: 2.728 TB [0x15d50a3b0 Sectors]
Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors]
Coerced Size: 2.728 TB [0x15d400000 Sectors]
Sector Size:  0
Firmware state: Online, Spun Up
Device Firmware Level: M440
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000cca03ec76599
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: HITACHI HUS723030ALS640 M440YVKJNHGK            
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 Temperature :36C (96.80 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: 32
Slot Number: 3
Drive's position: DiskGroup: 0, Span: 0, Arm: 3
Enclosure position: 1
Device Id: 3
WWN: 5000CCA03EC8035F
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: 2.728 TB [0x15d50a3b0 Sectors]
Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors]
Coerced Size: 2.728 TB [0x15d400000 Sectors]
Sector Size:  0
Firmware state: Online, Spun Up
Device Firmware Level: M440
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000cca03ec8035d
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: HITACHI HUS723030ALS640 M440YVKK005K            
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 Temperature :34C (93.20 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: 32
Slot Number: 4
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 4
WWN: 5000CCA03EC7FFC7
Sequence Number: 4
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS

Raw Size: 2.728 TB [0x15d50a3b0 Sectors]
Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors]
Coerced Size: 2.728 TB [0x15d400000 Sectors]
Sector Size:  0
Firmware state: Online, Spun Up
Device Firmware Level: M440
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000cca03ec7ffc5
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: HITACHI HUS723030ALS640 M440YVKJZSSK            
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 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 
Port-1 :
Port status: Active
Port's Linkspeed: Unknown 
Drive has flagged a S.M.A.R.T alert : No

硬盘过多 内容重复 已省略

[root@F11 MegaCli]#  ./MegaCli64 -LDInfo -Lall -aALL  
                                     

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                :
RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
Size                : 8.185 TB
Sector Size         : 512
Parity Size         : 2.728 TB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 4
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
Default Power Savings Policy: Controller Defined
Current Power Savings Policy: None
Can spin up in 1 minute: Yes
LD has drives that support T10 power conditions: Yes
LD's IO profile supports MAX power savings with cached writes: No
Bad Blocks Exist: No
Is VD Cached: Yes
Cache Cade Type : Read Only
 

另外有价值的参考网址:

http://blog.chinaunix.net/uid-25135004-id-3139293.html

http://blog.csdn.net/smithereensman/article/details/51320499

猜你喜欢

转载自my.oschina.net/u/3652215/blog/1586738