服务器在线运行过程中,增加硬盘并组建raid,DELL服务器可以通过idrac,其他服务器往往也有类似的图形界面可以操作raid卡,然而往往很多服务器没有正确配置idrac或者连接网线导致无法连接,那么也可以通过MegaCli来直接操作raid卡。
安装 rpm -qa | egrep ‘Lib_Utils|MegaCli’ //检查是否安装 下载链接:https://raw.githubusercontent.com/crazy-zhangcong/tools/master/MegaCli8.07.10.tar.gz ftp://download2.boulder.ibm.com/ecc/sar/CMA/XSA/ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip https://hy-ob-image.oss-cn-hangzhou.aliyuncs.com/file/MegaCli8.07.10.tar.gz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [root@localhost MegaCli8.07.10]# tree ├── Linux │ ├── Lib_Utils-1.00-09.noarch.rpm │ ├── MegaCli-8.02.21-1.noarch.rpm │ ├── readme.txt │ └── Run-Linux-PERC.sh └── WINDOWS ├── MegaCli64.exe ├── MegaCli.exe ├── readme.txt ├── X64.bat └── X86.bat [root@localhost Linux]# rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.02.21-1.noarch.rpm [root@localhost Linux]# ln -sv /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/ "/usr/bin/MegaCli64" -> "/opt/MegaRAID/MegaCli/MegaCli64"
硬盘命令使用 1、常用查询命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 /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相关信息】
2、查看磁盘缓存策略 1 2 3 4 5 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L0 -a0【显示0 RAID卡 0 RAID组的缓存策略 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -L1 -a0【显示1 RAID卡 0 RAID组的缓存策略】 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL -a0【显示所有RAID卡 0 RAID组的缓存策略】 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -Cache -LALL –aALL【显示所有 RAID卡 所有 RAID组的缓存策略】 /opt/MegaRAID/MegaCli/MegaCli64 -LDGetProp -DskCache -LALL -aALL
设置磁盘的缓存模式和访问方式 (Change Virtual Disk Cache and Access Parameters)
1 2 3 4 5 6 7 8 9 10 11 12 13 Description Allows you to change the following virtual disk parameters: -WT (Write through), WB (Write back): Selects write policy. -NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy. -Cached, -Direct: Selects cache policy. -RW, -RO, Blocked: Selects access policy. -EnDskCache: Enables disk cache. -DisDskCache: Disables disk cache. MegaCli -LDSetProp { WT | WB|NORA |RA | ADRA|-Cached|Direct} | {-RW|RO|Blocked} | {-Name[string]} | {-EnDskCache|DisDskCache} –Lx | -L0,1,2|-Lall -aN|-a0,1,2|-aALL MegaCli -LDSetProp WT -L0 -a0
3、设置磁盘缓存策略 显示磁盘缓存和访问方式(Display Virtual Disk Cache and Access Parameters)
1 2 3 4 5 6 7 8 MegaCli -LDGetProp -Cache | -Access | -Name | -DskCache -Lx|-L0,1,2| -Lall -aN|-a0,1,2|-aALL Displays the cache and access policies of the virtual disk(s): -WT (Write through), WB (Write back): Selects write policy. -NORA (No read ahead), RA (Read ahead), ADRA (Adaptive read ahead): Selects read policy. -Cache, -Cached, Direct: Displays cache policy. -Access, -RW, -RO, Blocked: Displays access policy. -DskCache: Displays physical disk cache policy.
缓存策略解释:
1 2 3 4 5 6 7 WT (Write through) WB (Write back) NORA (No read ahead) RA (Read ahead) ADRA (Adaptive read ahead) C (Cached) D (Direct)
例子:
1 2 3 4 5 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0 /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached|-Direct -L0 -a0 enable / disable disk cache /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -EnDskCache|-DisDskCache -L0 -a0
4、创建阵列 创建一个 raid5 阵列,由物理盘 2,3,4 构成,该阵列的热备盘是物理盘 5
1 2 3 4 5 6 /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0 创建阵列,不指定热备 /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0 创建一个 raid10 阵列,由物理盘 2,3 和 4,5 分别做 raid1,在将两组 raid1 做 raid0 /opt/MegaRAID/MegaCli/MegaCli64 –CfgSpanAdd –r10 –Array0[1:2,1:3] –Array1[1:4,1:5] WB Direct -a0
5、删除阵列 1 /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdDel -L1 -a0
6、在线添加磁盘 1 /opt/MegaRAID/MegaCli/MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0
7、阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。 1 2 3 4 /opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ShowProg -LALL -aALL 或者以动态可视化文字界面显示 /opt/MegaRAID/MegaCli/MegaCli64 -LDInit -ProgDsply -LALL -aALL
8、查看阵列后台初始化进度 1 2 3 4 /opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ShowProg -LALL -aALL 或者以动态可视化文字界面显示 /opt/MegaRAID/MegaCli/MegaCli64 -LDBI -ProgDsply -LALL -aALL
9、指定第 5 块盘作为全局热备 1 2 /opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
10、指定为某个阵列的专用热备 1 /opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0
11、删除全局热备 1 2 3 /opt/MegaRAID/MegaCli/MegaCli64 -PDHSP -Rmv -PhysDrv[1:5] -a0
12、将某块物理盘下线 / 上线 1 2 3 /opt/MegaRAID/MegaCli/MegaCli64 -PDOffline -PhysDrv [1:4] -a0 /opt/MegaRAID/MegaCli/MegaCli64 -PDOnline -PhysDrv [1:4] -a0
13、查看物理磁盘重建进度 1 2 3 4 /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0 或者以动态可视化文字界面显示 /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv [1:5] -a0
14、磁盘状态的变化,从拔盘,到插盘过程中 Device |Normal|Damage|Rebuild|Normal Virtual Drive |Optimal|Degraded|Degraded|Optimal Physical Drive |Online|Failed –> Unconfigured|Rebuild|Online
其他命令说明 1、当前 raid 缓存状态,raid 缓存状态设置为 wb 的话要注意电池放电事宜,设置电池放电模式为自动学习模式 1 /opt/MegaRAID/MegaCli/MegaCli64 -ldgetprop -dskcache -lall -aall
2、电池设置相关 查看电池状态信息 (Display BBU Status Information)
1 2 MegaCli -AdpBbuCmd -GetBbuStatus -aN|-a0,1,2|-aALL MegaCli -AdpBbuCmd -GetBbuStatus -aALL
查看电池容量(Display BBU Capacity Information)
1 2 MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aN|-a0,1,2|-aALL MegaCli -AdpBbuCmd -GetBbuCapacityInfo –aALL
查看电池设计参数 (Display BBU Design Parameters)
1 2 MegaCli -AdpBbuCmd -GetBbuDesignInfo -aN|-a0,1,2|-aALL MegaCli -AdpBbuCmd -GetBbuDesignInfo –aALL
查看电池属性(Display Current BBU Properties)
1 2 MegaCli -AdpBbuCmd -GetBbuProperties -aN|-a0,1,2|-aALL MegaCli -AdpBbuCmd -GetBbuProperties –aALL
设置电池为学习模式为循环模式(Start BBU Learning Cycle) Description Starts the learning cycle on the BBU. No parameter is needed for this option. MegaCli -AdpBbuCmd -BbuLearn -aN|-a0,1,2|-aALL
3、通过脚本检测 RAID 磁盘状态 1 2 3 MEGACLI="/opt/MegaRAID/MegaCli/MegaCli64 " $ MEGACLI -pdlist -aALL | grep "Firmware state" | awk -F : '{print $2}' | awk -F , '{print $1}' $ MEGACLI -pdlist -aALL | grep -E "Media Error|Other Error" | awk -F : '{print $2}'
添加硬盘创建raid1完整过程 检查物理硬盘 这里有几个重要信息
raid卡控制器为Adapter 0,后面的命令中缩写为a0
设备号为252
我新增了两块2T的硬盘,对应插槽为slot4和5
硬盘状态为Firmware state: JBOD1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 [root@node192 MegaCli]# ./MegaCli64 -PDList -aAll Adapter #0 Enclosure Device ID: 252 Slot Number: 0 Drive's postion: DiskGroup: 0, Span: 0, Arm: 0 Enclosure position: 0 Device Id: 10 WWN: 500A07513EFC1908 Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 894.252 GB [0x6fc81ab0 Sectors] Non Coerced Size: 893.752 GB [0x6fb81ab0 Sectors] Coerced Size: 893.137 GB [0x6fa46800 Sectors] Firmware state: Online, Spun Up Is Commissioned Spare : NO Device Firmware Level: MQ31 Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221100000000 Connected Port Number: 0(path0) Inquiry Data: 3EFC1908MTFDDAK960TGA-1BC16A 03KH064D7B07739LEN MQ31 FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Solid State Device Drive Temperature :24C (75.20 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's write cache : Enabled Drive's NCQ setting : Enabled Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Enclosure Device ID: 252 Slot Number: 1 Drive's postion: DiskGroup: 0, Span: 0, Arm: 1 Enclosure position: 0 Device Id: 11 WWN: 500A07513EFC05ED Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 894.252 GB [0x6fc81ab0 Sectors] Non Coerced Size: 893.752 GB [0x6fb81ab0 Sectors] Coerced Size: 893.137 GB [0x6fa46800 Sectors] Firmware state: Online, Spun Up Is Commissioned Spare : NO Device Firmware Level: MQ31 Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221101000000 Connected Port Number: 1(path0) Inquiry Data: 3EFC05EDMTFDDAK960TGA-1BC16A 03KH064D7B07739LEN MQ31 FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Solid State Device Drive Temperature :24C (75.20 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's write cache : Enabled Drive's NCQ setting : Enabled Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Enclosure Device ID: 252 Slot Number: 2 Drive's postion: DiskGroup: 0, Span: 1, Arm: 0 Enclosure position: 0 Device Id: 12 WWN: 500A07513EFCE078 Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 894.252 GB [0x6fc81ab0 Sectors] Non Coerced Size: 893.752 GB [0x6fb81ab0 Sectors] Coerced Size: 893.137 GB [0x6fa46800 Sectors] Firmware state: Online, Spun Up Is Commissioned Spare : NO Device Firmware Level: MQ31 Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221102000000 Connected Port Number: 2(path0) Inquiry Data: 3EFCE078MTFDDAK960TGA-1BC16A 03KH064D7B07739LEN MQ31 FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Solid State Device Drive Temperature :23C (73.40 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's write cache : Enabled Drive's NCQ setting : Enabled Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Enclosure Device ID: 252 Slot Number: 3 Drive's postion: DiskGroup: 0, Span: 1, Arm: 1 Enclosure position: 0 Device Id: 13 WWN: 500A07513EFC1D94 Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 894.252 GB [0x6fc81ab0 Sectors] Non Coerced Size: 893.752 GB [0x6fb81ab0 Sectors] Coerced Size: 893.137 GB [0x6fa46800 Sectors] Firmware state: Online, Spun Up Is Commissioned Spare : NO Device Firmware Level: MQ31 Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221103000000 Connected Port Number: 3(path0) Inquiry Data: 3EFC1D94MTFDDAK960TGA-1BC16A 03KH064D7B07739LEN MQ31 FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Solid State Device Drive Temperature :24C (75.20 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's write cache : Enabled Drive's NCQ setting : Enabled Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Enclosure Device ID: 252 Slot Number: 4 Enclosure position: 0 Device Id: 15 WWN: 5002538F7410B6EC Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 1.746 TB [0xdf8fe2b0 Sectors] Non Coerced Size: 1.745 TB [0xdf7fe2b0 Sectors] Coerced Size: 1.745 TB [0xdf66a800 Sectors] Firmware state: JBOD Device Firmware Level: 204Q Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221104000000 Connected Port Number: 5(path0) Inquiry Data: S6KTNC0X100952 SAMSUNG MZ7L31T9HBNA-00B7C JXTE204Q FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Solid State Device Drive Temperature :29C (84.20 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's write cache : Enabled Drive's NCQ setting : Enabled Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Enclosure Device ID: 252 Slot Number: 5 Enclosure position: 0 Device Id: 14 WWN: 5002538F0320777E Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 1.746 TB [0xdf8fe2b0 Sectors] Non Coerced Size: 1.745 TB [0xdf7fe2b0 Sectors] Coerced Size: 1.745 TB [0xdf66a800 Sectors] Firmware state: JBOD Device Firmware Level: 204Q Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221105000000 Connected Port Number: 4(path0) Inquiry Data: S6KTNE0W207678 SAMSUNG MZ7L31T9HBNA-00B7C JXTE204Q FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Solid State Device Drive Temperature :30C (86.00 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's write cache : Enabled Drive's NCQ setting : Enabled Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Exit Code: 0x00
设置硬盘状态 这里由于没有更多的测试机器,无法确定是常态还是个例,我新增的两块硬盘在插入后通过unraid模式直接挂载到服务器内,因此创建raid的时候提示硬盘状态异常,不允许我创建raid,因此手动修改硬盘状态。
1 2 3 4 5 6 [root@master192 MegaCli]# ./MegaCli64 -CfgLdAdd -r1[252:4,252:5] -a0 The specified physical disk does not have the appropriate attributes to complete the requested command. Exit Code: 0x26
手动修改磁盘状态
1 2 3 4 5 6 [root@node192 MegaCli]# ./MegaCli64 -PDMakeGood -PhysDrv[252:4,252:5] -force -a0 Adapter: 0: EnclId-252 SlotId-4 state changed to Unconfigured-Good. Adapter: 0: EnclId-252 SlotId-5 state changed to Unconfigured-Good. Exit Code: 0x00
创建raid1 这里又碰到了很奇怪的问题,第一次运行命令的时候提示报错了,但是又再次执行了一遍就成功了,并且在多台服务器上能重现,搞不懂~~~
1 2 3 4 5 6 7 8 9 10 [root@node192 MegaCli]# ./MegaCli64 -cfgldadd -r1[252:4,252:5] WT NORA Direct NoCachedBadBBU -a0 proc_add_new_ld: scandir failed Failed while adding the configuration to OS. Exit Code: 0xfffffffe [root@node192 MegaCli]# ./MegaCli64 -cfgldadd -r1[252:4,252:5] WT NORA Direct NoCachedBadBBU -a0 Exit Code: 0x1a
检查逻辑磁盘状态 这里创建出了Virtual Drive: 1,检查下缓存策略等是否符合预期,并且此时通过fdisk命令可以看到一块硬盘已经可以读到,进行分区使用了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 [root@node192 MegaCli]# ./MegaCli64 -LDInfo -LALL -aAll Adapter 0 -- Virtual Drive Information: Virtual Drive: 0 (Target Id: 0) Name : RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 Size : 1.744 TB Mirror Data : 1.744 TB State : Optimal Strip Size : 256 KB Number Of Drives per span:2 Span Depth : 2 Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU Current Cache Policy: WriteThrough, ReadAheadNone, 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 PI type: No PI Is VD Cached: No Virtual Drive: 1 (Target Id: 1) Name : RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 Size : 1.745 TB Mirror Data : 1.745 TB State : Optimal Strip Size : 256 KB Number Of Drives : 2 Span Depth : 1 Default Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU Current Cache Policy: WriteThrough, ReadAheadNone, 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 PI type: No PI Is VD Cached: No Exit Code: 0x00
设置磁盘缓存策略 这里我想修改另一台服务器策略WT为WB,提示由于BBU状态异常,无法修改,这里BBU是个啥呢,请参考 https://blog.csdn.net/zhezhe101/article/details/124587099
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [root@master192 MegaCli]# ./MegaCli64 -LDSetProp WB -L2 -a0 Adapter 0: Get BBU Status Failed. So policy Change to WB will not come into effect immediately Set Write Policy to WriteBack on Adapter 0, VD 2 (target id: 2) success Exit Code: 0x00 [root@master192 MegaCli]# ./MegaCli64 -LDInfo -LALL -aAll Adapter 0 -- Virtual Drive Information: Virtual Drive: 0 (Target Id: 0) Name : RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 Size : 1.744 TB Mirror Data : 1.744 TB State : Optimal Strip Size : 256 KB Number Of Drives per span:2 Span Depth : 2 Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU Current Cache Policy: WriteThrough, ReadAheadNone, 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 PI type: No PI Is VD Cached: No Virtual Drive: 1 (Target Id: 1) Name :VD_2 RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 Size : 893.137 GB Mirror Data : 893.137 GB State : Optimal Strip Size : 256 KB Number Of Drives : 2 Span Depth : 1 Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU Current Cache Policy: WriteThrough, ReadAheadNone, 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 PI type: No PI Is VD Cached: No Virtual Drive: 2 (Target Id: 2) Name : RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 Size : 1.745 TB Mirror Data : 1.745 TB State : Optimal Strip Size : 256 KB Number Of Drives : 2 Span Depth : 1 Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU Current Cache Policy: WriteThrough, ReadAheadNone, 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 PI type: No PI Is VD Cached: No Exit Code: 0x00
通过命令修改BBU**(高危勿学,我仅仅只是为了测试WT和WB对性能的影响,实际生产还是开了WT)**
1 2 3 4 5 [root@master192 MegaCli]# ./MegaCli64 -LDSetProp CachedBadBBU -L2 -aALL Set Write Cache OK if bad BBU on Adapter 0, VD 2 (target id: 2) success Exit Code: 0x00
这里可以用下面的命令改回去
1 2 3 4 5 [root@master192 MegaCli]# ./MegaCli64 -LDSetProp NOCachedBadBBU -L2 -aALL Set No Write Cache if bad BBU on Adapter 0, VD 2 (target id: 2) success Exit Code: 0x00
参考https://www.cnblogs.com/xingxiz/p/10411248.html https://blog.csdn.net/zhezhe101/article/details/124587099