背景:
针对现在很多用户有在线更换硬盘的需求。而且相当一部分用户的linux没有图形,无法使用MegaRAID StorageManager。特别是使用ESXi的主机协商停机更是费劲。之前的MegaCLI不支持最新的12Gb规格的RAID卡,所以大家有必要学习下storcli的使用。
环境要求
需要安装Storcli工具
rpm –ivh /path/storcli-1.13.06-1.noarch.rpm
说明:
windows、Linux、VMware exsi系统下storcli工具使用没有区别,只是在工具安装方法上有区别,本文主要以Linux系统为例说明
Linux系统操作步骤:
1.查看vd状态,找到故障pd
cd/opt/MegaRAID/storcli/
./storcli64 /cx show alarm|backplane|badblocks|copyback|
./storcli64 /cx show all 显示某一块raid卡的版本、功能、状态、以及raid卡下的物理磁、逻辑盘信息
./storcli64 /cx/v0-2|v1,2|vall show 显示逻辑磁盘信息
./storcli64 /cx/eall/sall show 显示物理磁盘信息
./storcli64 /cx/dall This command is used to find the missingdrives
2.定位故障pd。(有背板使用/c0/e252/s0格式,无背板使用/c0/s0格式)
./storcli64 /cx/ex/sx start locate 定位某块磁盘
./storcli64 /cx/ex/sx stop locate
3.假如有外部raid信息
./storcli64 /cx/fall show
./storcli64 /cx/fall del
./storcli64 /cx[/ex]/sx insert dg=A array=B row=C #Replace Missing PD
3.假如没有copyback
./storcli /cx[/ex]/sx show copyback
./storcli /cx[/ex]/sx start copyback target=eID:sID
例:./storcli64/c0/e25/s4 start copyback target=25:8回写
3.假如没有自动rebuild
./storcli64 /cx/ex/sx start| pause|resume rebuild
./storcli64 /cxset rebuildrate=x 整数,设置rebuildrate速度0to100
./storcli64 /cxshow rebuildrate
./storcli64 /cx/ex/sx show rebuild 查看rebild
./storcli64 /cxset autorebuild=on
3.假如是raid0单盘使用,需要创建新vd, Storcli创建raid
./storcli64 /c0add vd raid0 names=data drives=252:2-3,5 把slot2、3、5创建一个叫data的raid0
例:./storcli64 /c0add vd raid10 size=2gb,3gb,4gb names=tmp1,tmp2,tmp3 drives=252:2-3,5,7PDperArray=2 把2、3、5、7创建一个阵列,每个磁盘组两块盘,在阵列中分别创建tmp1=2gb,tmp2=3gb,tmp3=4gb三个虚拟磁盘。
./storcli64/c0/v1 del force
创建热备盘
./storcli64 /c0/e3/s6,8add hotsparedrive dgs=0,1 设置磁盘6,8为diskgroup0,1的热备盘;不加“dgs=”表示全局热备
./storcli64 /cx/ex/sx delete hostsparedrive
3.5.假如需要强制上线(谨慎操作)
./storcli64 /cxshow events [file=path]查看日志;加后面路径保存日志
./storcli64 /cx/ex/sx set jbod/good/offline/online/missing 设置某块磁盘的状态
./storcli64 /cx/fall import
./storcli64 /c0/fall show preview
./storcli64 /c0/fall import preview
./storcli64 /c0/fall show all
其他可能使用到的命令
./storcli /cx set alarm=<on|off|silence>报警=开|关|到下次重启前关闭
./storcli64 /cx/vx/vall set wrcache=wt/wb/awb 设置写策略
./storcli64 /cx/e34/s4 spindown准备移除
./storcli64 /cx/vx show bbmt Display the Bad BlockTable
./storcli64 /cxset copyback=on type=smartssd|smarthdd|all
./storcli64 /cxstart patrolread巡检
./storcli64 /c0set patrolread=on starttime=2012/02/21 03 2012.2.21凌晨3点巡检
./storcli64 /c0set patrolread delay=30
./storcli64 /c0set CC=on starttime=2012/02/21 03 excludevd v0-v3 vd0到vd3检查一致性
./storcli64 /cx[/ex]/sx set bootdrive=<on|off>
./storcli64 /cx[/ex]/sx start initialization
./storcli64 /cx/vx start init [full][Force]
./storcli64 /cx/vx start migrate <type=raidx> [option=<add|remove> drives=[e:]s|[e:]s-x|[e:]s-x,y][Force] raid迁移
./storcli64 /cxset time=yyyymmdd hh:mm:ss|systemtime
storcli /cx[/ex]/sx spindown Prepare to RemoveDrives
storcli /c0/v0show bbmt Display the Bad BlockTable
storcli /c0/v0delete bbmt Clear the LDBBM TableEntires
storcli /cx showevents file=<absolute path>
storcli /cx showdequeue log file =<filepath> debuglog
Flashing Controller Firmware Command
storcli /cx download file=filepath[fwtype=<value>0: Application 1: TMMC] [nosigchk] [noverchk] [resetnow]
VMware ESXi 安装storcli工具
准备:
上传storcli.zip
cd /vmfs/volumes/datastore1 (datastore1是用户创建存储池起的名字)
mkdir storcli
unzip storcli.zip –d storcli
cd storcli
./storcli /c0 show (如果没有可执行权限chmod +x storcli)
windows系统安装storcli工具
powershell或cmd
.\storcli64.exe
或者使用MegaRAID Storage Manager软件。有图形,更直观。
附录
硬件兼容性列表:
92xx系列RAID卡(2108、2208芯片)Sugon SL8-US
93xx系列RAID卡(3108…芯片)Sugon各种IOM及板载形式的3108RAID卡
语法:
[object identifier]> <verb><[adverb | attributes |properties] > <[key=value]>
x=number,eg:c0、v0、e0、s0……
参数解释:
add Adds/creates a newelement to controller like VD,Spare..etc
delete Deletes an elementlike VD,Spare
show Displaysinformation about an element
set Set a particularvalue to a property
get Get a particularvalue to a property
compare Compares particularvalue to a property
start Start backgroundoperation
stop Stop backgroundoperation
pause Pause backgroundoperation
resume Resume backgroundoperation
download Downloads file togiven device
expand expands size ofgiven drive
insert inserts new drivefor missing
transform downgrades thecontroller
/cx Controller specificcommands
/ex Enclosure specificcommands
/sx Slot/PD specificcommands
/vx Virtual drivespecific commands
/dx Disk group specificcommands
/fall Foreignconfiguration specific commands
/px Phy specificcommands
/[bbu|cv] Battery BackupUnit, Cachevault commands