Megacli操作磁盘的常用命令

这Megacli是操作磁盘Raid的常用软件,日常用的大多是dell家的机器,都是这软件,记录一下。

 1#!/bin/sh
 2#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0
 3/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0 | grep -A1 "Enclosure Device"
 4
 5# clear foreign disk 
 6#/opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -scan -a0
 7#/opt/MegaRAID/MegaCli/MegaCli64 -cfgforeign -clear -a0
 8
 9# clear Firmware state
10#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0 |grep 'Firmware state'
11#/opt/MegaRAID/MegaCli/MegaCli64 -PDMakeGood -Physdrv "[32:3]" -a0
12
13# clear Firmware JBOD mode, first turn into unconfig mode, then MakeGood
14#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0 |grep 'Firmware state'
15#/opt/MegaRAID/MegaCli/MegaCli64 -PDMakeGood -Physdrv [32:3] -force -a0
16
17#/opt/MegaRAID/MegaCli/MegaCli64 AdpGetProp EnableJBOD -aALL
18#/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp -EnableJBOD -1  -a0
19#/opt/MegaRAID/MegaCli/MegaCli64 -PDMakeJBOD -PhysDrv[252:0] -a0
20
21# create Raid0 
22#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0[252:3] -a0
23# Get old Cache, ex: Virtual Drive(Target ID 02)
24#/opt/MegaRAID/MegaCli/MegaCli64 -GetPreservedCacheList -a0
25# Clear cache, ex: Virtual Drive(Target ID 02)
26#/opt/MegaRAID/MegaCli/MegaCli64 -DiscardPreservedCache -L2 -a0
27# create Raid1 
28#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r1[252:4,252:5] -a0
29# create Raid5
30#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5[252:2,252:3,252:4,252:5] -a0
31# create Raid10
32#/opt/MegaRAID/MegaCli/MegaCli64 -CfgSpanAdd -r10 -Array0[32:4,32:5] -Array1[32:6,32:7] -a0
33
34#delete raid
35#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L0 -a0
36#Virtual Drive: 0 (Target Id: 0)
 1# check Raid
 2#/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL
 3#RAID 1
 4#RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
 5#RAID 5
 6#RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
 7
 8# check Raid disks
 9#/opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aAll | egrep "^Adapter|^Number of Virtual|^Virtual Drive:|^Name|^Enclosure Device ID:|^Slot Number:"
10
11# GPT part
12#parted -s /dev/sde mklabel gpt mkpart primary 0% 100%
13
14# check disk rebuild progress
15#/opt/MegaRAID/MegaCli/MegaCli64  -PDRbld -ShowProg -physdrv[32:1] -aALL
16#Rebuild Progress on Device at Enclosure 32, Slot 1 Completed 7% in 3 Minutes.
17
18# Force rebuild
19#/opt/MegaRAID/MegaCli/MegaCli64  -PDRbld -Start -physdrv[32:1] -a0
20# OR
21#/opt/MegaRAID/MegaCli/MegaCli64  -pdlocate -start -physdrv[32:1] -a0
22
23#Start rebuild, first clean the foreign configuration and then make the device hot spare (only if the above command failed)
24#/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -aALL
25#set global hostspare
26#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set -PhysDrv [32:1] -a0
27
28#If you need to unset/remove a global hotspare:
29#/opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Rmv -PhysDrv [32:1] -aN
30
31#downgrade raid6 --> raid5 ,and more space now can be used
32# -L0  virtual disk 0
33# /opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -L0 -a0
34# echo 1 > /sys/block/sda/device/rescan
35
36#Add disk to a raid5
37#/opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[32:3] -L0 -a
38
39#Configure WriteThrough or WriteBack
40#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -WT -Immediate -Lall -aAll
41#/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -WB -Immediate -Lall -aAll
42
43#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL |grep "Inquiry Data:"
44#Inquiry Data: SEAGATE ST600MP0005     VS08S7M04B0C            
45#Inquiry Data: SEAGATE ST600MP0005     VS08S7M04AFD            
46#Inquiry Data: SEAGATE ST600MP0005     VS08S7M04JAY            
47#Inquiry Data: SEAGATE ST600MP0005     VS08S7M04AAG            
48
49#/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL  | grep "Drive Temperature"
50#Drive Temperature :36C (96.80 F)
51#Drive Temperature :35C (95.00 F)

Oracle使用rman定时清除7天前的日志
Dell服务器用ssh方式划分磁盘Raid的方法
comments powered by Disqus