Storcli 常用管理命令汇总
目前LSI RAID
卡使用的配置工具主要有:Megaraid Storage Manager
(MSM,图形环境)、MegaCLI
(字符界面)、StorCLI
(字符界面)。其中StorCLI
作为MegaCLI
后继者整合了LSI
和原来3ware
的产品支持,兼容MegaCLI
命令的同时更加简洁。前面的文章记录了MegaCli
常用管理命令,本篇主要记录StorCLI
的使用。
# 安装Storcli
# Ubuntu
unzip ul_avago_storcli_1.18.11_anyos.zip
dpkg -i storcli_all_os/Ubuntu/storcli_1.18.11_all.deb
dpkg -l | grep -i storcli
1
2
3
2
3
# Centos
unzip ul_avago_storcli_1.18.11_anyos.zip
rpm -ivh storcli_all_os/Linux/storcli-1.18.11-1.noarch.rpm
rpm -qi storcli
ln -s /opt/MegaRAID/storcli/storcli64 /usr/local/bin/storcli
1
2
3
4
2
3
4
# ESXi 5.5 & ESXi 6.0
unzip ul_avago_storcli_1.18.11_anyos.zip
esxcli software vib install -v=vmware-esx-storcli-1.21.06.vib --no-sig-check
ln -s /opt/lsi/storcli/storcli /sbin/storcli
storcli -V
1
2
3
4
2
3
4
# storcli
使用
专有名词解释:
/cx, /vx
表示 Controller/Virtual Drive Number
.
/ex, /sx
表示 Enclosure/Slot ID
.
VD
表示 Virtual Drive
.
要输出json
格式的返回,在命令行最后添加J
.
- 固件升级
storcli /cx download file=/path/to/firmware.rom
1
- 查看控制器和配置信息
storcli /cx show all
1
- 使用激活码激活特性(如 CacheCade, FastPath,...)
storcli /cx set aso key=AAAAAAAABBBBBBBBCCCCCCCC
1
- 查看现有硬盘及其状态的信息 (IDs,...)
storcli /cx /eall /sall show (all)
1
返回结果
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-----------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp
-----------------------------------------------------------------------------
252:0 1 Onln 1 3.637 TB SATA HDD N N 512B WDC WD4000FYYZ-03UL1B3 U
252:1 3 Onln 1 3.637 TB SATA HDD N N 512B WDC WD4000FYYZ-03UL1B3 U
......
252:6 85 Onln 0 3.637 TB SATA HDD N N 512B WDC WD4000FYYZ-03UL1B3 U
252:7 2 UGood - 3.637 TB SATA HDD N N 512B WDC WD4000FYYZ-03UL1B3 D
-----------------------------------------------------------------------------
EID-Enclosure Device ID|Slt-Slot No.|DID-Device ID|DG-DriveGroup
DHS-Dedicated Hot Spare|UGood-Unconfigured Good|GHS-Global Hotspare
UBad-Unconfigured Bad|Onln-Online|Offln-Offline|Intf-Interface
Med-Media Type|SED-Self Encryptive Drive|PI-Protection Info
SeSz-Sector Size|Sp-Spun|U-Up|D-Down|T-Transition|F-Foreign
UGUnsp-Unsupported|UGShld-UnConfigured shielded|HSPShld-Hotspare shielded
CFShld-Configured shielded|Cpybck-CopyBack|CBShld-Copyback Shielded
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 现有虚拟硬盘及其状态的信息
storcli /cx /vall show (all)
1
- 查看当前所有重建的状态
storcli /cx /eall /sall show rebuild
1
# 创建/初始化 raid
shell
创建VD
storcli /cx add vd type=[RAID0(r0)|RAID1(r1)|...] drives=[EnclosureID:SlotID|:SlotID-SlotID|:SlotID,SlotID]
#more
storcli /cx add vd type=raid[0|1|5|6|00|10|50|60(r0|r1|...)] [Size=<VD1_Sz>,<VD2_Sz>,..|all] [name=<VDNAME1>,..] drives=e:s|e:s-x,y;e:s-x,y,z [PDperArray=x] [SED] [pdcache=on|off|default] [pi] [DimmerSwitch(ds)=default|automatic(auto)|none|maximum(max)|MaximumWithoutCaching(maxnocache)] [wt|wb] [nora|ra] [direct|cached] [CachedBadBBU|NoCachedBadBBU][cachevd] [Strip=<8|16|32|64|128|256|1024>] [AfterVd=X] [Spares = [e:]s|[e:]s-x|[e:]s-x,y] [force][ExclusiveAccess]
1
2
3
2
3
示例:
# 使用硬盘0-2创建raid1
storcli /cx add vd type=r1 drives=252:0-2
# 创建 raid5,write-bakc,read-ahead
storcli /cx add vd type=raid5 size=all names=VD1 drives=32:2-7 wb ra
# 创建 raid10/50/60,必须设定PDperArray参数,write-bakc,read-ahead
storcli /cx add vd type=raid10 size=all names=VD1 drives=32:2-7 PDperArray=2 wb ra
1
2
3
4
5
6
2
3
4
5
6
shell
之初始化VD
storcli /cx/vx start init (force)
1
- 监视初始化进度
storcli /cx/vx show init
1
shell
之移除VD
storcli /cx/vx del (force)
1
# 缓存加速
shell
之创建CacheCade
设备(SSD 缓存加速)
storcli /cx add vd cc type=r[0,1,10] drives=[EnclosureID:SlotID|:SlotID-SlotID|:SlotID,SlotID] WT|WB (assignvds=0,1,2)
1
示例:
storcli /c0 add vd cc type=r1 drives=252:2-3 WB
1
shell
之CacheCade
激活/停用
storcli /cx/[vx|vall] set ssdCaching=[on|off]
1
示例:
storcli /c0/v1 set ssdCaching=on
1
shell
之移除CacheCade
storcli /cx/vx del cc
1
# 误插拔设备合并
如果不正确地移除设备并重新连接到 RAID 控制器,它将被识别为 UBAD(Unconfigured Bad)。
storcli /c0 /eall /sall show
1
此时的返回结果:
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp
-------------------------------------------------------------------------------
252:0 7 Onln 0 465.25 GB SATA HDD N N 512B WDC WD5003ABYX-01WERA1 U
252:1 6 Onln 1 465.25 GB SATA HDD N N 512B WDC WD5003ABYX-01WERA1 U
252:2 5 UGood - 465.25 GB SATA HDD N N 512B WDC WD5003ABYX-01WERA1 U
252:3 4 UBad - 223.062 GB SATA SSD N N 512B INTEL SSDSC2CW240A3 U
-------------------------------------------------------------------------------
......
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
此时252:3
必需置为UGOOD
UBad
置为UGOOD
storcli /cx /ex /sx set good
1
返回结果
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.
Drive Information :
=================
-------------------------------------------------------------------------------
EID:Slt DID State DG Size Intf Med SED PI SeSz Model Sp
-------------------------------------------------------------------------------
252:0 7 Onln 0 465.25 GB SATA HDD N N 512B WDC WD5003ABYX-01WERA1 U
252:1 6 Onln 1 465.25 GB SATA HDD N N 512B WDC WD5003ABYX-01WERA1 U
252:2 5 UGood - 465.25 GB SATA HDD N N 512B WDC WD5003ABYX-01WERA1 U
252:3 4 UGood F 223.062 GB SATA SSD N N 512B INTEL SSDSC2CW240A3 U
-------------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
foreign
管理
此时硬盘为foreign
状态
storcli /cx /fall show
1
返回结果
Controller = 0
Status = Success
Description = Operation on foreign configuration Succeeded
FOREIGN CONFIGURATION :
=====================
----------------------------------------
DG EID:Slot Type State Size NoVDs
----------------------------------------
0 - Cac0 Frgn 223.062 GB 1
----------------------------------------
NoVDs - Number of VDs in disk group|DG - Diskgroup
Total foreign drive groups = 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
现在它可以重新包含在配置中
storcli /cx /fall import
1
如果设备是 RAID 的一部分,则会自动执行重建(请参阅概述中的状态:Rbld)。 可用以下命令监视进度:
storcli /cx /ex /sx show rebuild
1
# 其他
# 查看VD健康状态等,获取到坏盘的E:S编号,然后查看对应盘的SN
storcli /c0 /vall show [all]
storcli /c0 /eX /sY show all |grep SN
# 查看阵列卡
storcli show ctrlcount
# 查看 virtual disk 0 @controlor 0
storcli /cx /v0 show
# 查看 Controlor-0, Enclosure-7, Slot-7的磁盘信息
storcli /cx/e252/s7 show all
# 查看报警信息
storcli /cx show alarm
# 关闭beep蜂鸣器报警
storcli /cx set alarm=<on|off|silence>
# 定位磁盘仓位
storcli /c0/e8/s2 start/stop locate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 参考来源
编辑 (opens new window)
上次更新: 2024-07-15, 03:27:09