dell服务器硬盘的状态变成外来(foreign)命令行修复
Idrac监控报错:登陆ideac卡后如下如所示:硬盘状态是红叉,状态是外来
命令行安装MegaCli
rpm -ivh MegaCli-8.07.08-1.noarch.rpm
查看包的安装路径
rpm -ql MegaCli-8.07.08-1.noarch
/opt/MegaRAID/MegaCli/MegaCli
/opt/MegaRAID/MegaCli/MegaCli64
/opt/MegaRAID/MegaCli/libstorelibir-2.so.14.07-0
执行状态检测命令:
/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall |grep 'Firmware state'
Firmware state: Unconfigured(good), 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
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
此时的状态如下:
############
Enclosure Device ID: 32
Slot Number: 4
###Drive's position: DiskGroup: 0, Span: 2, Arm: 1 ###应该有这个信息的,但是这个没有
Enclosure position: 1
Device Id: 4
WWN: 5000C5005AAD3E28
Sequence Number: 1
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 102
Last Predictive Failure Event Seq Number: 41501
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]
Sector Size: 0
Firmware state: Unconfigured(good), Spun Up
Device Firmware Level: ES66
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c5005aad3e29
SAS Address(1): 0x0
Connected Port Number: 0(path0)
Inquiry Data: SEAGATE ST3600057SS ES666SL5A74S
FDE Capable: Not Capable
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 :45C (113.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
Port-1 :
Port status: Active
Port's Linkspeed: Unknown
Drive has flagged a S.M.A.R.T alert : Yes
############
执行导入命令
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Import -aall
Foreign configuration is imported on controller 0.
Exit Code: 0x00
再次执行状态检测命令:
/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall |grep 'Firmware state'
Firmware state: Rebuild
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
Firmware state: Online, Spun Up
查询 Rebuild 进度:
/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -showprog -physdrv[32:0] -a0
显示如下:
Rebuild Progress on Device at Enclosure 32, Slot 0 Completed 38% in 54 Minutes.
Exit Code: 0x00
或者
/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -ProgDsply -physdrv[32:0] -a0
显示如下:
Rebuild progress of physical drives...
Enclosure:Slot Percent Complete Time Elps
032 :00 ####################***40 %*********************** 00:56:40
Press <ESC> key to quit...
备注:
Enclosure Device ID: 32
Slot Number: 0
以上两条信息通过/opt/MegaRAID/MegaCli/MegaCli64 -pdlist -aall |less 来查看
扫描外来配置的个数:
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0
清除外来配置:
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -clear -a0
再次扫描外来配置的个数:
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0
参考:http://erikimh.com/raid-rebuilding-foreign-disk-by-hand/
Megacli是一款管理维护硬件RAID的工具,有LSI公司提供,LSI公司的raid卡,使用的比较广泛。我们可以通过megacli了解当前raid卡的所有信息,包括raid卡的型号,raid的阵列类型,raid上的磁盘状态,也可以通过它来直接创建阵列,在线添加磁盘等。
一,Megacli工具安装
可以在LSI公司的官网直接下载工具:
http://www.lsi.com/downloads/Public/Nytro/downloads/Nytro%20XD/MegaCli_Linux.zip
下载完成之后,是一个zip包,然后解压,安装:
# unzip MegaCli_Linux.zip
# cd MegaCli_Linux
# ls
megacli_8.07.08-1_all.deb MegaCli-8.07.08-1.noarch.rpm MegaSAS.log
# rpm -ivh MegaCli-8.07.08-1.noarch.rpm
安装成功之后,命令的默认安装路径为:
# /opt/MegaRAID/MegaCli/MegaCli64
二,查看磁盘的状态
作用:显示Raid卡型号,Raid设置,整列类型,Disk相关信息
# /opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL|less
1,查看raid整列类型和大小
如上图所示:
(1)通过RAID Level字段得知,disk group 0做的是一个raid5;
(2)disk group 0的大小为1.6TB;
2,查看raid的cache策略
如上图所示,raid的默认以及当前生效的cache策略为writeback(还有一种cache策略为WriteThrough)
策略说明:
(1). 第一段: WriteBack, WriteThrough
* WriteBack:进行写操作时,将数据写入RAID卡缓存,并直接返回,RAID卡控制器将在系统负载低或者Cache满了的情况下把数据写入硬盘。该设置会大大提升RAID卡写性能,绝大多数的情况下会降低系统IO负载。 数据的可靠性由RAID卡的BBU(Battery Backup Unit)进行保证。大多数情况下,我们都使用这种策略。
* WriteThrough: 数据写操作不使用缓存,数据直接写入磁盘。RAID卡写性能明显下降,在大多数情况下该设置会造成系统IO负载上升。特别对于io负载很大的服务,表现特别明显。
(2). 第二段: ReadAheadNone, ReadAdaptive, ReadAhead.
* ReadAheadNone: 不开启预读。这是默认的设置
* ReadAhead: 在读操作时,预先把后面顺序的数据加载入Cache,在顺序读取时,能提高性能,相反会降低随机读的性能。
* ReadAdaptive: 自适应预读,当Cache memory和IO空闲时,采取顺序预读,平衡了连续读性能及随机读的性能,需要消耗一定的计算能力。
(3). 第三段: Direct, Cached.
* Direct: Direct IO模式,读操作不缓存到cache memory中,数据将同时传输到cache中和应用,如果接下来要读取相同的数据块,则直接从Cache memory中获取. 这是默认的设置
* Cached: Cached IO模式,所有读操作都会缓存到cache memory中。
(4). 第四段: Write Cache OK if Bad BBU, No Write Cache if Bad BBU
* Write Cache OK if Bad BBU: 在BBU有问题时(如电池失效), 依旧使用Write Cache, 有一定的数据丢失风险.
* No Write Cache if Bad BBU: 在BBU有问题时, 不使用Write Cache
策略自动切换的问题由于MegaSAS RAID卡默认采用No Write Cache if Bad BBU的设置,将可能发生Write Cache策略变更的情况(由WriteBack变成WriteThrough),导致写性能下降,如果该自动变更发生在业务高峰且系统Io负载高的时候,可能会引发不可预测的问题,如卡机。以下原因将造成Write Cache策略的变更.
(1). RAID卡进入BBU Learn Cycle: 详细介绍见下面
(2). 检测到某些电池故障,如电池容量过低等,一般是电池老化带来的影响,IBM建议一年更换一次RAID卡电池
(3). 没有安装电池, 部分服务器购买时不带电池,导致被自动设置为WriteThrough
3,判定磁盘是否损坏
如上图所示,我们一般通过如上5个值,来判断磁盘是否应该报修:
1,Media Error
磁盘存在错误,可能是磁盘有坏道。值越大,越危险。根据磁盘状况,一般大于100报修更换。
2,Other Error
磁盘存在未知的错误,可能是磁盘松动,需要重新再插入。根据磁盘状况,一般大于100报修更换。
3,Predictive Failure Count
磁盘的预警数。一般大于0,就报修更换。
4,Last Predictive Failure Event Seq Number
最后一条预警的时间序列号。这个值不为0,肯定Predictive Failure Count也不为0
5,Firmware state
磁盘目前的状态。一般有9种,即
(1)Unconfigured Good – A drive accessible to the RAID controller but not configured as a part of
a virtual drive or as a hot spare.
(2)Online – A drive that can be accessed by the RAID controller and will be part of the virtual
drive.
(3)Rebuild – A drive to which data is being written to restore full redundancy for a virtual drive.
(4)Failed – A drive that was originally configured as Online or Hot Spare, but on which the
firmware detects an unrecoverable error.
(5)Unconfigured Bad – A drive on which the firmware detects an unrecoverable error; the drive
was Unconfigured Good or the drive could not be initialized.
(6)Missing – A drive that was Online, but which has been removed from its location.
(7)Offline – A drive that is part of a virtual drive but which has invalid data as far as the RAID
configuration is concerned.
(8)Hot Spare – A drive that is configured as a hot spare.
(9)None – A drive with an unsupported flag set. An Unconfigured Good or Offline drive that has
completed the prepare for removal operation.
(10)还有一种特殊的状态copyback:
从磁盘组中把数据复制到非磁盘组的磁盘中,然后等failed的盘更换之后,再从这个非磁盘组的磁盘中把数据给copyback回来。
做hot spare的盘,会出现这种情况:即原来的hot spare盘只是临时存放了数据,等failed的盘更换之后,把数据从hotspare的盘中复制回来,正常使用的还是新更换的盘,hot spare的盘永久做hot spare。
1.显示Rebuid进度
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -physdrv[20:2] -aALL
2.查看E S
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll -NoLog | grep -Ei "(enclosure|slot)"
3.查看所有硬盘的状态
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll -NoLog
4.查看所有Virtual Disk的状态
/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aAll -NoLog
RAID Level对应关系:
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 |
RAID 1 |
RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0 |
RAID 0 |
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 |
RAID 5 |
RAID Level : Primary-1, Secondary-3, RAID Level Qualifier-0 |
RAID 10 |
5.在线做Raid
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0[0:11] WB NORA Direct CachedBadBBU -strpsz64 -a0 -NoLog
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [12:2,12:3,12:4,12:5,12:6,12:7] WB Direct -a0
6.点亮指定硬盘(定位)
/opt/MegaRAID/MegaCli/MegaCli64 -PdLocate -start -physdrv[252:2] -a0
7.清除Foreign状态
/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -a0
8.查看RAID阵列中掉线的盘
/opt/MegaRAID/MegaCli/MegaCli64 -pdgetmissing -a0
9.替换坏掉的模块
/opt/MegaRAID/MegaCli/MegaCli64 -pdreplacemissing -physdrv[12:10] -Array5 -row0 -a0
10.手动开启rebuid
/opt/MegaRAID/MegaCli/MegaCli64 -pdrbld -start -physdrv[12:10] -a0
11.查看Megacli的log
/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog dsply -a0 > adp2.log
12.设置HotSpare
/opt/MegaRAID/MegaCli/MegaCli64-pdhsp -set[-Dedicated[-Array2]][-EnclAffinity][-nonRevertible]-PhysDrv[4:11]-a0
/opt/MegaRAID/MegaCli/MegaCli64-pdhsp -set[-EnclAffinity][-nonRevertible]-PhysDrv[32:1}]-a0
MegaCli -PDHSP -Set -Dedicated -Array0 -physdrv[E:S] -a0 添加局部热备盘,其中array0表示第0个raid
MegaCli -pdhsp -set -physdrv[E:S] -a0 添加全局热备盘
MegaCli -pdhsp -rmv -physdrv[E:S] -a0 移除全局和热备局部热备
13.关闭Rebuild
/opt/MegaRAID/MegaCli/MegaCli64 -AdpAutoRbld -Dsbl -a0
14.设置rebuild的速率
/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp RebuildRate -30 -a0
附其他详细命令:
1. 常用命令:
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 查raid级别
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 查raid卡信息
#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看硬盘信息
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 查看电池信息
#/opt/MegaRAID/MegaCli/MegaCli64 -FwTermLog -Dsply -aALL 查看raid卡日志
#/opt/MegaRAID/MegaCli/MegaCli64 -adpCount 【显示适配器个数】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpGetTime –aALL 【显示适配器时间】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll 【显示所有适配器信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll 【显示所有逻辑磁盘组信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll 【显示所有的物理信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep ‘Charger Status’ 【查看充电状态】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL【显示BBU状态信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuCapacityInfo -aALL【显示BBU容量信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuDesignInfo -aALL 【显示BBU设计参数】
#/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuProperties -aALL 【显示当前BBU属性】
#/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL 【显示Raid卡型号,Raid设置,Disk相关信息】
#/opt/MegaRAID/MegaCli/MegaCli64 -adpallinfo -aall|grep -i temp 查看温度
2. 磁带状态的变化,从拔盘,到插盘的过程中
Device |Normal|Damage|Rebuild|Normal
Virtual Drive |Optimal|Degraded|Degraded|Optimal
Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
3. 查看磁盘缓存策略
#/opt/MegaCli -LDGetProp -Cache -L0 -a0
or
#/opt/MegaCli -LDGetProp -Cache -L1 -a0
or
#/opt/MegaCli -LDGetProp -Cache -LALL -a0
or
#/opt/MegaCli -LDGetProp -Cache -LALL -aALL
or
#/opt/MegaCli -LDGetProp -DskCache -LALL -aALL
4.设置磁盘缓存策略
缓存策略解释:
WT (Write through
WB (Write back)
NORA (No read ahead)
RA (Read ahead)
ADRA (Adaptive read ahead)
Cached
Direct
例子:
#/opt/MegaCli -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
or
#/opt/MegaCli -LDSetProp -Cached|-Direct -L0 -a0
or
enable / disable disk cache
#/opt/MegaCli -LDSetProp -EnDskCache|-DisDskCache -L0 -a0
/opt/MegaRAID/MegaCli/MegaCli64 -DiscardPreservedCache -Lall -a0 -NoLOG 【清空缓存】
5. 创建一个 raid5 阵列,由物理盘 2,3,4 构成,该阵列的热备盘是物理盘 5
#/opt/MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0
6. 创建阵列,不指定热备
#/opt/MegaCli -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0
7. 删除阵列
#/opt/MegaCli -CfgLdDel -L1 -a0
8. 在线添加磁盘
#/opt/MegaCli -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0
9. 阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。
#/opt/MegaCli -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaCli -LDInit -ProgDsply -LALL -aALL
10. 查看阵列后台初始化进度
#/opt/MegaCli -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
#/opt/MegaCli -LDBI -ProgDsply -LALL -aALL
11. 指定第 5 块盘作为全局热备
#/opt/MegaCli -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
12. 指定为某个阵列的专用热备
#/opt/MegaCli -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
13. 删除全局热备
#/opt/MegaCli -PDHSP -Rmv -PhysDrv[1:5] -a0
14. 将某块物理盘下线/上线
#/opt/MegaCli -PDOffline -PhysDrv [1:4] -a0
15. 查看物理磁盘重建进度
#/opt/MegaCli -PDRbld -ShowProg -PhysDrv [1:5] -a0
或者以动态可视化文字界面显示
#/opt/MegaCli -PDRbld -ProgDsply -PhysDrv [1:5] -a0
dell服务器硬盘的状态变成外来(foreign)命令行修复相关推荐
- 命令行 修复系统_让我们修复旧的命令行
命令行 修复系统 by Manuel Vila 通过曼努埃尔·维拉(Manuel Vila) 让我们修复旧的命令行 (Let's fix the good old command line) Alth ...
- 当systeminfo不能显示系统启动时间了--用命令行修复一下
有时候为了工作需要或者其他原因查询电脑工作了多长时间,使用系统自带的systeminfo来查询的时候发现:"系统启动时间:暂缺"这个时候很多人员选择了选择下载UPTIME来查询.当 ...
- U盘cmd命令行修复
U盘打不开,也无法格式化运行CMD,再输入CHKDSK G:/F (这里的G:就是你要修复的盘符) 操作完后,u盘一切恢复正常 转载于:https://www.cnblogs.com/cdxkyz/a ...
- U盘读取文件时发现损坏,命令行修复
这是我今天准备清理u盘的时候发现u盘好多文件出现这种损毁,后来知道是之前亲戚家小孩在我穿文件的时候插拔u盘了,emmm在网上查找了一下方法大部分都是推荐用系统的自己的u盘修复 修复步骤 1.win+r ...
- 20个命令行工具监控 Linux 系统性能(转载)
1. top - Linux 系统进程监控 top 命令是性能监控程序,它可以在很多 Linux/Unix 版本下使用,并且它也是 Linux 系统管理员经常使用的监控系统性能的工具.Top 命令可以 ...
- getopts命令行参数处理
getopts命令行参数处理 一.getopts 简介 由于shell命令行的灵活性,自己编写代码判断时,复杂度会比较高.使用内部命令 getopts 可以很方便地处理命令行参数.一般格式为: get ...
- clion上添加程序的预定添加程序的命令行
例如我想在程序上,debug的状态下,添加命令行 //例如,本来生成是 mosquitto_sub //但我想在debug的状态下,添加命令行弄成如下,而方便我去测试 mosquitto_sub -h ...
- Windows 系统上使用任务管理器查看进程的各项属性(命令行、DPI、管理员权限等)
Windows 系统上的任务管理器进化到 Windows 10 的 1809 版本后,又新增了几项可以查看的进程属性. 本文介绍可以使用任务管理器查看的各种进程属性. 本文内容 如何查看进程的各种属性 ...
- Zabbix-3.0.X 监测服务器硬盘IO状态
Zabbix-3.0监测服务器硬盘IO状态 一.环境准备 被监控主机已安装zabbix-agent,且zabbix-server能正常监控到zabbix-agent相关数据. 系统环境: Zabbix ...
最新文章
- CentOS 如何搭建本地和局域网yum源
- html创建php,php-从html创建图像
- 剑指offer(C++)——链表中环的入口结点
- php异步传输,php 异步处理-上传文件
- 诺基亚n1平板电脑刷机教程_【个人记事本】闲鱼购买平板的经历
- C++拷贝构造函数的调用时机
- 使用loadrunner编写webservice接口请求
- python组合数据类型实验_实验七 组合数据类型
- Python 装饰器 函数
- 51单片机的轮胎气压监测系统_汽车的胎压监测系统有哪些作用?
- linux 检测蓝牙 rssi,蓝牙LE信号强度Linux
- PyTorch系列入门到精通——GPU的使用
- 如何通过ildasm/ilasm修改assembly的IL代码
- 服务器如何用pe系统安装,pe下安装服务器系统安装教程
- win10用账户登录计算机,Win10没有改用本地账户登录选项的解决方案
- php验证是否是jwt,php实现JWT认证的方法 JWT验证使用流程
- STM32F429 13. SPI 通讯(code)
- 联合概率数据关联JPDAF详解
- eclipse/myeclipse下web项目部署时报没有webroot的错误
- 智慧汽车服务2.0.6 汽车美容 保养 维修 洗车一站式平台源码
热门文章
- Linux配置网络是什么意思,linux-networking – CentOS 7中IPv6配置选项的含义是什么?...
- 向量相似度度量(一):EMD (Earth Mover's Distance)
- 如何估算要写多少条测试用例,耗费多长时间
- 量化投资 第27章 K线图 27.1
- OKapi BM25算法
- 远程桌面连接使用教程
- 差异表达基因热图怎么看_R绘图 雷达图-单基因泛癌差异表达的另类展现形式
- 【Nginx】陶辉老师100讲第三章序
- Cache Coherence for GPU Architectures
- oracle学生成绩表的创建,oracle如何创建视图(1)创建视图V_StudInfo,查询学生的学号,姓名,所修课程号,所修课程名称,成绩等级(9...