1:查看RAID控制卡信息(为了获取Enclosure Device ID,如果有多个RAID控制器,请确认需要创建RAID的物理磁盘连接在哪个RAID控制器,然后获取ID,不同控制器下的磁盘不能创建在同一个GROUP)
/opt/MegaRAID/MegaCli/MegaCli64 -cfgdsply -aALL |grep 'Enclosure Device ID'
返回结果:
Enclosure Device ID: 32
2:创建RAID10
/opt/MegaRAID/MegaCli/MegaCli64 -CfgSpanAdd -r10 -Array0[32:4,32:5] -Array1[32:6,32:7] WB Direct -a0
命令解释:
CfgSpanAdd:创建RAID命令
-r10 :RAID10,如果创建RAID5,则为-r5
-Array0[32:4,32:5] : RAID10相当于RAID1+RAID0,本例中为磁盘编号为4的物理磁盘和编号为5的物理磁盘组成一个RAID1,磁盘编号为6的物理磁盘和编号为7的物理磁盘组成一个RAID1,然后两个RAID1组成一个RAID0。(其中32为第一步取得的)
-Array1[32:6,32:7]同上解释
WB :缓存策略,支持的策略可以使用以下命令查看:
/opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L0 -a0
返回信息:
Adapter 0-VD 0(target id: 0): Cache Policy:WriteBack, ReadAdaptive, Direct, Write Cache OK if bad BBU
Direct:缓存策略,查看方式同上条命令
-a0:即adpter0,RAID卡0,如果有更多RAID卡,请确认当前要操作的适配器,可用下面命令查看
/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aAll
创建RAID10命令的返回结果:
proc_add_new_ld: scandir failed
Failed while adding the configuration to OS.
Exit Code: 0xfffffffe
实际上已经创建成功,重启服务器即可生效。
3:重启服务器后使用以下命令查看RAID情况:
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -LALL -aAll
返回结果如下:
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :raid-10
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 557.75 GB
Mirror Data : 557.75 GB
State : Optimal
Strip Size : 64 KB
Number Of Drives per span:2
Span Depth : 2
Default Cache Policy: WriteBack, ReadAdaptive, Direct, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAdaptive, Direct, Write Cache OK 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
Virtual Drive: 1 (Target Id: 1)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 1.818 TB
Mirror Data : 1.818 TB
State : Optimal
Strip Size : 64 KB
Number Of Drives per span:2
Span Depth : 2
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: No
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
Exit Code: 0x00
4:查看RAID初始化情况:
/opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ShowProg -LALL -aALL
返回结果如下:
Background Initialization on VD #0 is not in Progress.
Background Initialization on VD #1 (target id #1) Complete 9% in 18 Minutes.
表明VD 1正在初始化,18分钟完成了9%(此时已可以使用,控制器在后台初始化RAID组)
如果需要删除RAID,使用以下命令:(慎用)
/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -a0
删除RAID控制器0上的编号为1的逻辑磁盘
返回结果如下:
Adapter 0: Deleted Virtual Drive-1(target id-1)
Exit Code: 0x00
查看磁盘rebuild进度
/opt/MegaRAID/MegaCli/MegaCli -PDRbld -ProgDsply -PhysDrv [32:4] -a0
-P Physical
D Disk
Rbld Rebuild
-Prog Progress
Dsply Display
-PhysDrv Physical Diskdirve
[32:4] Enclosure Device ID:Disk Slot
-a0 visual disk array0