带阵列卡的机器打开磁盘cache

1、在HBA卡环境下:

1-1、如果是后SAS盘

[root@localhost ~]# sdparm /dev/sdf 
/dev/sdf: SEAGATE ST4000NM0023 0004
Read write error recovery mode page:
AWRE 1 [cha: y, def: 1, sav: 1]
ARRE 1 [cha: y, def: 1, sav: 1]
PER 0 [cha: y, def: 0, sav: 0]
Caching (SBC) mode page:
WCE 1 [cha: y, def: 1, sav: 1]
RCD 0 [cha: y, def: 0, sav: 0]
Control mode page:
SWP 0 [cha: n, def: 0, sav: 0]
Informational exceptions control mode page:
EWASC 1 [cha: y, def: 1, sav: 1]
DEXCPT 0 [cha: y, def: 0, sav: 0]
MRIE 0 [cha: y, def: 0, sav: 0]

 

Check HDD Write cache status #

sdparm /dev/sda 

WC is disabled, it should show ‘Caching mode page = 0.

WC is enabled, it should show ‘Caching mode page = 1.
Disable write cache #

sdparm –s WCE=0 --save /dev/sda
 

Enable write cache #

sdparm –s WCE=1 --save /dev/sda

1-2、如果是SATA盘 则使用 sg3

安装:yum install sg3*

检查硬盘的cache是否打开:hdparm -W  /dev/sdd

如果cache打开则显示:write caching = 1 (on)

如果cache没有打开:write caching = not supported

打开cache :sg_raw –s 512 –i WCE.bin /dev/sda A1 0A 25 D6 01 E0 4F C2 A0 B0 00 00

关闭cache:sg_raw –s 512 –i WCD.bin /dev/sda A1 0A 25 D6 01 E0 4F C2 A0 B0 00 00

磁盘的默认设置:sg_raw –s 512 –i WC_Set_feature.bin /dev/sda A1 0A 25 D6 01 E0 4F C2 A0 B0 00 00

WC_Set_feature.bin

WCD.BIN

WCE.BIN

 

2、在Raid卡环境下,使用Megacli直接关闭或打开:

MegaCli -LDSetProp -EnDskCache|-DisDskCache -L0 -a0 

注:如果是第3块 逻辑硬盘,则 命令为:MegaCli -LDSetProp -EnDskCache|-DisDskCache -L3 -a0 
———————————————————————————————
原文链接:https://blog.csdn.net/u013000139/article/details/50371468

posted @ 2019-11-18 10:38  larry-peng  阅读(2422)  评论(0编辑  收藏  举报