RAID卡的缓存与磁盘自带的缓存的关系

RAID卡是否有(启用)缓存对“随机读写”性能有巨大的影响。中高端的RAID卡都有缓存(价格也高)。

那么RAID卡的缓存磁盘自带的缓存是如何设置的?

戴尔服务器的perc H710 RAID卡有512M缓存,并带电池。

建立阵列的时候(raid5),关于RAID卡缓存的默认选项是:

读取策略:自适应

写策略:回写

磁盘高速缓存策略:禁用

属性解释:

读取策略:一般要启用,采用预读取策略,可提高“随机读取”性能。第二次读取相同数据时可以命中缓存。

写策略:

一般要启用“回写”,操作的是RAID卡上的缓存。

写入数据时先写入到缓存就算写入成功了,然后RAID卡控制器再把多个写IO合并为一个写IO一次性写入磁盘,提高“随机写入”的性能。

因为RAID卡带电池,机房停电时,电池可给缓存供电72小时。缓存中的数据不会丢失。

另外,如果没有给缓存接电池,默认“写缓存”是不被启用的(除非强行设定为“没有电池也启用写缓存”)。

磁盘高速缓存策略:

操作的是磁盘自带的高速缓存。 做RAID时,一般要禁用,防止机房停电时磁盘自带缓存中的数据丢失。磁盘可不带电池。

RAID卡控制器可控制磁盘自带的缓存是否启用。

家用台试机(未使用RAID卡)在windows操作系统中有选项可以控制磁盘自带的缓存是否启用(默认启用)。

Windows如何开启、关闭磁盘写缓存

打开磁盘写入缓存可以提高操作系统的性能 ;但是,突然停电时它可能导致信息的丢失。下面介绍如何启用磁盘写入缓存打开或关闭。

打开或关闭磁盘写入缓存:

1、用鼠标右键单击我的电脑,然后单击属性

2、单击硬件选项卡,然后单击设备管理器

3、扩展磁盘驱动器

4、用鼠标右键单击您要在其打开磁盘写入缓存打开或关闭,的驱动器,然后单击属性

5、单击策略选项卡。

6、单击以选中或清除相应的启用写入缓存在磁盘上复选框。

7、单击确定

Linux如何开启、关闭硬盘写缓存(Write Cache)

在Linux中,有时我们希望打开或关闭硬盘写缓存(Write Cache),此时可以用hdparm命令来实现。

建议下载最新hdparm版本,网址为:http://sourceforge.net/projects/hdparm/ 下载自行安装

CentOS 5.4 默认带的hdparm是6.6版本,要升级一下。yum update hdparm,试了好几个yum源,最新的都是6.6,不能通过yum升级。

hdparm的改变是个临时的状态,下次再次启动Linux系统的时候hdparm将会消失。所以要想永久的保存修改后的信息,就必须把修改后的参数和数据写入/etc/rc.d/rc.local或/etc/rc.local文档,甚至比启动过程要早运行的程式中。

安装 hdparm

用以下命令安装 hdparm:

make &&

make install

注意在默认情况下, hdparm 是安装在 /sbin 因为一些系统可呢能需要它在启动时在/usr被连接前. 如果你想把 hdparm 安装在 /usr下, 那么替换上面的命令为下面这个:

make &&

make binprefix=/usr install

测试服务器磁盘读写速度:hpparm -T -t /dev/sdx

-T 表示不读取磁盘,直接从Linux缓存读取数据的速度

-t 表示不使用预先的数据缓冲从磁盘连续读取的速度

/dev/sdx是设备名

查看当前硬盘写Cache状态

root@ubuntu:~/hdparm-9.37# hdparm -W /dev/sda

关闭硬盘的写Cache

root@ubuntu:~/hdparm-9.37# hdparm -W 0 /dev/sda

打开硬盘的写Cache

root@ubuntu:~/hdparm-9.37# hdparm -W 1 /dev/sda

hdparm的参数参数说明:

root@ubuntu:~/hdparm-9.37# ./hdparm -h

hdparm – get/set hard disk parameters – version v9.37, by Mark Lord.

Usage: hdparm [options] [device …]

Options:

-a Get/set fs readahead

-A Get/set the drive look-ahead flag (0/1)

-b Get/set bus state (0 == off, 1 == on, 2 == tristate)

-B Set Advanced Power Management setting (1-255)

-c Get/set IDE 32-bit IO setting

-C Check drive power mode status

-d Get/set using_dma flag

-D Enable/disable drive defect management

-E Set cd/dvd drive speed

-f Flush buffer cache for device on exit

-F Flush drive write cache

-g Display drive geometry

-h Display terse usage information

-H Read temperature from drive (Hitachi only)

-i Display drive identification

-I Detailed/current information directly from drive

-k Get/set keep_settings_over_reset flag (0/1)

-K Set drive keep_features_over_reset flag (0/1)

-L Set drive doorlock (0/1) (removable harddisks only)

-m Get/set multiple sector count

-M Get/set acoustic management (0-254, 128: quiet, 254: fast)

-n Get/set ignore-write-errors flag (0/1)

-N Get/set max visible number of sectors (HPA) (VERY DANGEROUS)

-p Set PIO mode on IDE interface chipset (0,1,2,3,4,…)

-P Set drive prefetch count

-q Change next setting quietly

-Q Get/set DMA queue_depth (if supported)

-r Get/set device readonly flag (DANGEROUS to set)

-R Obsolete

-s Set power-up in standby flag (0/1) (DANGEROUS)

-S Set standby (spindown) timeout

-t Perform device read timings

-T Perform cache read timings

-u Get/set unmaskirq flag (0/1)

-U Obsolete

-v Use defaults; same as -acdgkmur for IDE drives

-V Display program version and exit immediately

-w Perform device reset (DANGEROUS)

-W Get/set drive write-caching flag (0/1)

-x Obsolete

-X Set IDE xfer mode (DANGEROUS)

-y Put drive in standby mode

-Y Put drive to sleep

-z Re-read partition table

-Z Disable Seagate auto-powersaving mode

–dco-freeze Freeze/lock current device configuration until next power cycle

–dco-identify Read/dump device configuration identify data

–dco-restore Reset device configuration back to factory defaults

–direct Use O_DIRECT to bypass page cache for timings

–drq-hsm-error Crash system with a “stuck DRQ” error (VERY DANGEROUS)

–fallocate Create a file without writing data to disk

–fibmap Show device extents (and fragmentation) for a file

–fwdownload Download firmware file to drive (EXTREMELY DANGEROUS)

–fwdownload-mode3 Download firmware using min-size segments (EXTREMELY DANGEROUS)

–fwdownload-mode3-max Download firmware using max-size segments (EXTREMELY DANGEROUS)

–fwdownload-mode7 Download firmware using a single segment (EXTREMELY DANGEROUS)

–idle-immediate Idle drive immediately

–idle-unload Idle immediately and unload heads

–Istdin Read identify data from stdin as ASCII hex

–Istdout Write identify data to stdout as ASCII hex

–make-bad-sector Deliberately corrupt a sector directly on the media (VERY DANGEROUS)

–offset use with -t, to begin timings at given offset (in GiB) from start of drive

–prefer-ata12 Use 12-byte (instead of 16-byte) SAT commands when possible

–read-sector Read and dump (in hex) a sector directly from the media

–security-help Display help for ATA security commands

–trim-sector-ranges Tell SSD firmware to discard unneeded data sectors: lba:count ..

–trim-sector-ranges-stdin Same as above, but reads lba:count pairs from stdin

–verbose Display extra diagnostics from some commands

–write-sector Repair/overwrite a (possibly bad) sector directly on the media (VERY DANGEROUS)

此条目发表在新闻头条分类目录,贴了, , 标签。将固定链接加入收藏夹。