专栏首页阿dai_linux使用 MegaCLI 检测磁盘状态并更换磁盘 原
10

  • Scan me!
  •  
  •  
  •  
Scan me!

使用 MegaCLI 检测磁盘状态并更换磁盘 原

2019-04-03阅读 9420
 

之前写了一篇文章介绍如何更换线上服务器磁盘操作流程,当时是把整体机器的磁盘全部不换掉了,但是最近另一台机器部分磁盘损坏,raid类型为10,经检测,只需要更换坏掉的磁盘即可,补充文档如下。

安装MegaCLI

安装包 下载地址

安装过程

# 首先下载获取安装包
# 解压
$ tar -zxf MegaCli8.07.10.tar.gz
$ cd MegaCli8.07.10/Linux/
$ rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.21-1.noarch.rpm # 加入系统环境
$ ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/local/bin/MegaCli
$ MegaCli -v
MegaCLI SAS RAID Management Tool Ver 8.02.21 Oct 21, 2011 (c)Copyright 2011, LSI Corporation, All Rights Reserved. Exit Code: 0x00
# 安装完成!
  • 冲突处理: $ rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.21-1.noarch.rpm 准备中... ################################# [100%] file /opt/lsi/3rdpartylibs/x86_64/libsysfs.so.2.0.2 from install of Lib_Utils-1.00-09.noarch conflicts with file from package srvadmin-storelib-sysfs-9.1.0-2757.12163.el7.x86_64
  • 原因: Lib_Utils和Dell服务器自带的包srvadmin冲突,直接将其卸载,然后安装即可。 rpm -e srvadmin-storelib-sysfs-9.1.0-2757.12163.el7.x86_64 --nodeps

使用指南

基本用法

# 查raid级别
$ megacli -LDInfo -Lall -aALL # 查raid卡信息
$ megacli -AdpAllInfo -aALL # 查看硬盘信息
$ megacli -PDList -aALL # 查看电池信息
$ megacli -AdpBbuCmd -aAll # 查看raid卡日志
$ megacli -FwTermLog -Dsply -aALL # 显示适配器个数
$ megacli -adpCount # 显示适配器时间
$ megacli -AdpGetTime –aALL # 显示所有适配器信息
$ megacli -AdpAllInfo -aAll # 显示所有逻辑磁盘组信息
$ megacli -LDInfo -LALL -aAll # 显示所有的物理信息
$ megacli -PDList -aAll # 查看充电状态
$ megacli -AdpBbuCmd -GetBbuStatus -aALL |grep 'Charger Status' # 显示BBU状态信息
$ megacli -AdpBbuCmd -GetBbuStatus -aALL # 显示BBU容量信息
$ megacli -AdpBbuCmd -GetBbuCapacityInfo -aALL # 显示BBU设计参数
$ megacli -AdpBbuCmd -GetBbuDesignInfo -aALL # 显示当前BBU属性
$ megacli -AdpBbuCmd -GetBbuProperties -aALL # 显示Raid卡型号,Raid设置,Disk相关信息
$ megacli -cfgdsply -aALL
## 磁带状态的变化,从拔盘,到插盘的过程中。
Device |Normal |Damage |Rebuild |Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online |Failed Unconfigured|Rebuild|Online # 查看物理磁盘状态:
$ megacli -PDRbld -ShowProg -PhysDrv [Enclosure Device ID:Slot Number] -a0
## Rebuild 中的物理磁盘状态中会显示:"Firmware state: Rebuild" # 查询 Rebuild 进度:
$ megacli -pdrbld -showprog -physdrv[E:S] -aALL
## 返回内容类似于下面这样:
Rebuild Progress on Device at Enclosure 32, Slot 5 Completed 77% in 101 Minutes. # 以文本进度条样式显示 Rebuild 进度:
$ megacli -pdrbld -progdsply -physdrv[E:S] -aALL
## 屏幕显示类似下面的内容:
Rebuild progress of physical drives...
Enclosure:Slot Percent Complete Time Elps
032 :05 #######################87 %################******* 01:59:07
Press key to quit... # 查看 RAID 卡 Rebuild 参数:
$ megacli -AdpAllinfo -aALL | grep -i rebuild
## 返回结果类似下面这样
Rebuild Rate : 30%
Auto Rebuild : Enabled
Rebuild Rate : YesForce
Rebuild : Yes # 设置 RAID 卡 Rebuild 比例为60%:
$ megacli -AdpSetProp { RebuildRate -60} -aALL
## 设置成功后返回:
Adapter 0: Set rebuild rate to 60% success.

MegaCLI使用方法:http://blog.51cto.com/daixuan/1863567

重要参数

参数名称

含义

Firmware state

磁盘状态

Firmware state: Online, Spun Up

磁盘正常

Firmware state: Unconfigured(good), Spun Up

磁盘已安装,但未启用

Firmware state: Unconfigured(bad)

故障, 对应hwcheck的 Non-Critical

Firmware state: Failed

故障, 对应hwcheck的Critical

Firmware state: Rebuild

重建,一般在更换磁盘时显示

Enclosure Device ID: 32

设备

Slot Number: 1

磁盘在服务器上的槽位

Adapter #0

适配器编号,对应 -a 参数

实战:raid10环境下替换硬盘

Raid10环境下换硬盘还是很简单的,支持热插拔,直接拔下换掉就可以了,下面是操作步骤。

主要环境

服务器: R720

系统: CentOS7

raid类型:raid10

查看硬盘信息

为了更加清楚的呈现操作过程,未对信息简化处理。

$ MegaCli -PDList -aAll -NoLog

Adapter #0

Enclosure Device ID: 32
Slot Number: 0
Drive's postion: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 0
WWN: 5000C50076CD09B4
Sequence Number: 1
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 28
Last Predictive Failure Event Seq Number: 4378
PD Type: SAS
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]
Coerced Size: 558.375 GB [0x45cc0000 Sectors]
Firmware state: Unconfigured(good), Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c50076cd09b5
SAS Address(1): 0x0
Connected Port Number: 5(path0)
Inquiry Data: SEAGATE ST3600057SS ES666SL8SASQ
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: Foreign
Foreign Secure: Drive is not secured by a foreign lock key
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :40C (104.00 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Drive's write cache : Disabled
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 : Yes Enclosure Device ID: 32
Slot Number: 2
Enclosure position: 0
Device Id: 2
WWN: 5000C50076CD05BC
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: 0 KB [0x0 Sectors]
Non Coerced Size: 0 KB [0x0 Sectors]
Coerced Size: 0 KB [0x0 Sectors]
Firmware state: Unconfigured(bad)
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c50076cd05bd
SAS Address(1): 0x0
Connected Port Number: 1(path0)
Inquiry Data: SEAGATE ST3600057SS ES666SL8SAVC
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: Unknown
Link Speed: Unknown
Media Type: Hard Disk Device
Drive: Not Supported
Drive Temperature :0C (32.00 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Drive's write cache : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: Unknown
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 postion: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 0
Device Id: 1
WWN: 5000C500983873BC
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.375 GB [0x45cc0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: VT31
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c500983873bd
SAS Address(1): 0x0
Connected Port Number: 3(path0)
Inquiry Data: SEAGATE ST600MP0005 VT31S7M1CSLT
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: Unknown
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :41C (105.80 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Drive's write cache : Disabled
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 postion: DiskGroup: 0, Span: 1, Arm: 1
Enclosure position: 0
Device Id: 3
WWN: 5000C50076CE2F30
Sequence Number: 2
Media Error Count: 5
Other Error Count: 71
Predictive Failure Count: 15
Last Predictive Failure Event Seq Number: 4379
PD Type: SAS
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Non Coerced Size: 558.411 GB [0x45cd2fb0 Sectors]
Coerced Size: 558.375 GB [0x45cc0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c50076ce2f31
SAS Address(1): 0x0
Connected Port Number: 2(path0)
Inquiry Data: SEAGATE ST3600057SS ES666SL8SAKA
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 :48C (118.40 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Drive's write cache : Disabled
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 : Yes Enclosure Device ID: 32
Slot Number: 4
Drive's postion: DiskGroup: 1, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 4
WWN: 5000C5007E70F0F8
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.375 GB [0x45cc0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c5007e70f0f9
SAS Address(1): 0x0
Connected Port Number: 0(path0)
Inquiry Data: SEAGATE ST3600057SS ES666SL9F1JB
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 :46C (114.80 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Drive's write cache : Disabled
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: 5
Drive's postion: DiskGroup: 1, Span: 0, Arm: 1
Enclosure position: 0
Device Id: 5
WWN: 5000C5007E708E3C
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.375 GB [0x45cc0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c5007e708e3d
SAS Address(1): 0x0
Connected Port Number: 4(path0)
Inquiry Data: SEAGATE ST3600057SS ES666SL9F2RB
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 :45C (113.00 F)
PI Eligibility: No
Drive is formatted for PI information: No
PI: No PI
Drive's write cache : Disabled
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 Exit Code: 0x00

由以上信息可知该服务器有6块磁盘(Device Id)。

卸载故障硬盘

$ MegaCli -PDOffline -PhysDrv[32:2] -a0
$ MegaCli -PDOffline -PhysDrv[32:0] -a0

上面命令中 32 和 2 以及 -a0 的对应关系:

Adapter #0
Enclosure Device ID: 32
Slot Number: 2

替换故障硬盘

此时故障硬盘已经OFFLINE,在服务器现场查看时,故障硬盘闪烁的是黄灯,正常硬盘的绿灯; 拔下故障硬盘,插上好硬盘,硬盘灯闪烁为绿色,并硬盘快速旋转,表示硬盘正在rebuild状态,查看状态如下:

$ MegaCli -PDList -aAll -NoLog
...
Enclosure Device ID: 32
Slot Number: 3
...
Firmware state: Rebuild
...

查看rebuild进度

$ MegaCli -PDRbld -ShowProg -PhysDrv[32:2] -aAll

Rebuild Progress on Device at Enclosure 32, Slot 3 Completed 16% in 94 Minutes.

磁盘更换完成

$ MegaCli -PDList -aAll -NoLog | grep 'Firmware state'
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up

(adsbygoogle = window.adsbygoogle || []).push({});

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

使用 MegaCLI 检测磁盘状态并更换磁盘的更多相关文章

  1. MegaCli是一款管理维护硬件RAID软件,可以通过它来了解当前raid卡的所有信息,包括 raid卡的型号,raid的阵列类型,raid 上各磁盘状态

    MegaCli 监控raid状态 转载weixin_30344131 最后发布于2015-10-16 13:05:00 阅读数    简介 MegaCli是一款管理维护硬件RAID软件,可以通过它来了 ...

  2. contos7 使用zabbix监控物理磁盘状态实例

    一.系统环境: 物理机:dell R640 操作系统:centos7 二.安装MegaCli 监控主要是通过MegaCli 软件获取到物理主机的read及硬盘相关状态信息.然后通过zabbix的自定义 ...

  3. windows server 2016 x64用MecaCli工具检查raid5磁盘状态

    下载并安装lsi MegaRAID raid卡 管理工具 下载网址:http://www.avagotech.com/support/download-search 在搜索框里搜索"mega ...

  4. asm磁盘组,asm磁盘状态学习

    说明:在数据库中巡检,发现,数据库某个磁盘组状态为mount,其余磁盘组均为CONNECTED状态,排除是否异常 文档流程: 1.实际环境查询校验 2.官方文档视图中对磁盘组,磁盘状态的解释说明 3. ...

  5. windows无法安装到这个磁盘。选中的磁盘采用GPT分区形式 Windows 检测到 EFI 系统分区格式化为 NTFS。将 EFI 系统分区个数化为 FAT32,然后重新启动安装

    win10安装问题解决 问题 1.windows无法安装到这个磁盘.选中的磁盘采用GPT分区形式 解决方法: 1.bios,更改 uefi/legacy boot 为ueei only 后面可以安装了 ...

  6. 规划ASM DISK GROUP、查看asm 磁盘当前状态、mount or dismount 磁盘组、检查磁盘组 metadata 的内部一致性

    规划ASM DISK GROUP: 1. 每个磁盘组里的磁盘应该大小.性能.新旧等一致,不能有太大差距 2. 对database files 和 fast recovery area 分别创建不同的d ...

  7. MegaCli 监控raid状态 限戴尔服务器

    MegaCli 监控raid状态 MegaCli是一款管理维护硬件RAID软件,可以通过它来了解当前raid卡的所有信息,包括 raid卡的型号,raid的阵列类型,raid 上各磁盘状态,等等.通常 ...

  8. MegaCli 监控raid状态

    MegaCli 监控raid状态 http://blog.chinaunix.net/uid-25135004-id-3139293.html 简介 MegaCli是一款管理维护硬件RAID软件,可以 ...

  9. linux磁盘管理、新增磁盘、分区、挂载

    1. du -sh 查看目录.文件总大小 -a:全部文件与目录大小都列出来.如果不加任何选项和参数只列出目录(包含子目录)大小. -c:最后加总2. df -h 查看磁盘使用量3. lsblk 查看系 ...

随机推荐

  1. 前端 | vxe-table 翻页保留复选框状态

    0 前言 在前端开发过程中时常会遇到表格相关的显示与处理.组件库通常都会提供表格组件,对于展示.简单操作这些常用功能通常也够用:但如果需要更多的定制或进行比较复杂的操作,组件库自带的组件可能会捉襟见肘 ...

  2. [树形DP]没有上司的晚会

    没 有 上 司 的 晚 会 没有上司的晚会 没有上司的晚会 题目描述 Ural大学有N个职员,编号为1~N.他们有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司.每个职 ...

  3. 【DB宝47】企业知识分享+团队协作神器之Confluence

    目录 一.Confluence简介 二.知识库软件对比 三.快速安装confluence 7.4.6版本 四.confluence基本操作简介 4.1.创建空间(Space) 4.2.配置空间权限 4 ...

  4. 结对作业-stage_1

    教学班 罗杰.任建班周五3.4节 gitlab项目地址 Here it is. 成员 周远航(3004) 李辰洋(3477) 结对编程体验 感受 在前期设计时,两人合作可以收集更多资料,提供更多想法, ...

  5. 【接入指南】一个Demo带你玩转华为帐号服务

    在<接入指南:一文带你了解华为帐号服务>中已经给大家介绍了华为帐号服务有哪些优势,如一键授权登录华为全场景共享.共享华为帐号所有用户资源.帐号安全可靠.接入方便快捷等,以及为什么能帮助开发 ...

  6. ES6转ES5(Babel转码器)

    ES6转ES5(Babel转码器) 前提:必须在VScode中已经安装了Node.js 官网:https://nodejs.org/en/ 一.安装命令行转码工具 npm install --glob ...

  7. 前端 JS 原生 javascript 和 location.hash 实现一个单页应用的路由 router

    开篇日常立个flag-- 前言 最近在做一些应用,类似于单页应用,想实现类似于 Vue 路由的效果. 但是个人 Vue 基础四舍五入约等于无,而且看着 Vue-router 吃力+用不起来(因为我的项 ...

  8. Spring Security OAuth 2.0 发放令牌接口地址自定义

    OAuth 2.0 如何获取令牌 以密码模式为例,获取 Token curl --location --request POST 'http://oauth-server/oauth/token' \ ...

  9. 自定义grub主题

    1 概述 自定义grub引导菜单的主题,笔者的linux是deepin,感觉默认的grub主题不太好看,嗯,没办法,就是想改了. 这篇文章主要是修改/boot/grub/grub.cfg以及/boot ...

  10. CloudBase CMS + Next.js:轻松构建一个内容丰富的站点

    项目背景 试想一下,如果你现在要为你自己或者你所在的组织创建一个强内容的站点,同时要求好的 SEO(搜素引擎优化),比如博客,你会怎么做呢? 由 vite 或者 create-react-app 等脚 ...