use hdparm change ATA SATA DISK's Write-Read-Verify feature set

前面测试了OCZ PCI-E接口的SSD硬盘RevoDrive3的性能, 确实不错.

其中hdparm看到的信息如下 : 

有一条, Write-Read-Verify feature set

也就是说这个硬盘支持这个特性, 只是没有开启.

但是hdparm系统带的版本不能修改这个. 需要用到更新的hdparm版本.

下载地址 : http://sourceforge.net/projects/hdparm/

编译时会有点问题, 我这用到的是CentOS 5.7 x64的版本.

hdparm.o: In function `dump_sectors':
hdparm.c:(.text+0x19c0): undefined reference to `le16toh'
hdparm.c:(.text+0x19ee): undefined reference to `le16toh'
hdparm.c:(.text+0x1a24): undefined reference to `le16toh'
collect2: ld returned 1 exit status
gmake: *** [hdparm] Error 1

原因是找不到这个函数, 这个函数原本应该在endian.h中声明的. 但是CentOS 5.7 x64的endian.h中没有. 

这个函数的功能参考 : 

http://www.kernel.org/doc/man-pages/online/pages/man3/endian.3.html

所以需要修改一下hdparm.c 以下行 :

printf("%04x", le16toh(w[0]));  

注释这行

// printf("%04x", le16toh(w[0]));  

或者修改这行.

printf("%04x", w[0]);  

再编译 :

gmake
gmake install

确认版本信息 :

[root@db-172-16-3-150 hdparm-9.43]# hdparm -V
hdparm v9.43

使用帮助 :

[root@db-172-16-3-150 hdparm-9.43]# hdparm -h

hdparm - get/set hard disk parameters - version v9.43, 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
 -J   Get/set Western DIgital "Idle3" timeout for a WDC "Green" drive (DANGEROUS)
 -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   Get/set device write-read-verify flag
 -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)

开启write-read-verify :

[root@db-172-16-3-150 hdparm-9.43]# hdparm -R 2 /dev/mapper/mpath1
/dev/mapper/mpath1:
 setting write-read-verify to 2
 write-read-verify =  2

确认已经开启 :

[root@db-172-16-3-150 hdparm-9.43]# hdparm -I /dev/mapper/mpath1|grep Write-Read-Verify
           *    Write-Read-Verify feature set

开启后IO性能将急剧下降.

关闭write-read-verify :

[root@db-172-16-3-150 hdparm-9.43]# hdparm -R 0 /dev/mapper/mpath1
/dev/mapper/mpath1:
 setting write-read-verify to 0
 write-read-verify =  0

确认已经关闭 : 

[root@db-172-16-3-150 hdparm-9.43]# hdparm -I /dev/mapper/mpath1|grep Write-Read-Verify
                Write-Read-Verify feature set

【参考】

1. http://sourceforge.net/projects/hdparm/

2. http://blog.163.com/digoal@126/blog/static/163877040201210279569426/

3. http://blog.163.com/digoal@126/blog/static/1638770402012102613815282/
4. http://www.kernel.org/doc/man-pages/online/pages/man3/endian.3.html

时间: 2024-12-04 18:40:47

use hdparm change ATA SATA DISK's Write-Read-Verify feature set的相关文章

两个命令:hdparm和iozone参数解释

1.hdpram: haochuang@computer9:~$ 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

串行ATA高级主控接口致XP蓝屏故障的解决

笔者从网上淘了一台ThinkPad SL500(27466AC)笔记本,自带Vista系统,外观和质量都不错,唯一不足的是内存只有1GB,在Vista下玩游戏不够流畅,于是打算将Vista换为WinXP系统.但无论是用正版还是盗版WinXP SP2安装盘,在安装时总是出现蓝屏现象.经过一番研究后,发现AHCI(串行ATA高级主控接口)模式会影响安装.最后,笔者用以下方法顺利安装好WinXP系统,而且也能开启AHCI模式,让硬盘提高效率. 关闭AHCI,安装路上无路障 AHCI是包括Intel在内

主板sata接口不认硬盘怎么办

  主板sata接口不认硬盘的原因及解决方法: 一.硬盘无法使用的故障 1.BIOS设置错误 主要出现在BIOS中有关SATA的设置错误,特别是一些早期的主板使用第三方的SATA/RAID控制芯片,但基本上在BIOS中是被关闭的,所以要使用该硬盘,需要把这个芯片打开. 2.SATA接头故障 这种故障有2种可能: 1)接头松动,现象就是开机听得到硬盘自检声,但在BIOS中不能找到硬盘. 2)接头不干净,现象主要是传输速度慢或出现暂停.碰到这种情况就先要把SATA的接口内的金属性用酒精擦拭干净,然后

IDE、SATA、SCSI、SAS、iSCSI

IDE是并口硬盘,(5400-7200转): SATA是串口硬盘,(7200转): SCSI是服务器硬盘,(60.80针,10000转). 硬盘的传输速率:作为电脑中最重要的数据存储设备和数据交换媒介,硬盘传输速率的快慢直接影响了系统的运行速度.不同类型的硬盘,其传输速率往往差别很大.现在主流硬盘主要有三种:按照不同的接口可以分为并口ATA硬盘(即IDE硬盘).SCSI硬盘和Serial ATA硬盘. 小知识:1.硬盘的内部数据传输率 内部数据传输率是磁头到硬盘的高速缓存之间的数据传输速度,这可

Introduction to Change Data Capture (CDC) in SQL Server 2008[转]

Change Data Capture records INSERTs, UPDATEs, and DELETEs applied to SQL Server tables, and makes a record available of what changed, where, and when, in simple relational 'change tables' rather than in an esoteric chopped salad of XML. These change

smartmontools monitor storage device's health status

不管是SSD硬盘还是机械硬盘, 都有使用寿命. 大多数的硬盘是支持S.M.A.R.T的, 全称(Self-Monitoring, Analysis and Reporting Technology) smartmontools这个工具可以用来读取硬盘的smart信息, 进行测试, 改变一些属性等. 操作系统自带的smartmontools版本较低, 所以建议去源站下载一个最新的, 可以支持更多的硬盘. 使用smartmontools可以提前知道哪些硬盘可能要坏了, 做好预先更换的准备. 像EMC

Linux中如何开启硬盘ATA66模式

Linux中如何开启硬盘ATA66模式,我们可以使用hdparm命令来实现: hdparm - get/set hard disk http://www.aliyun.com/zixun/aggregation/12616.html">parameters - version v9.16 Usage:  hdparm  [options] [device] .. Options: -a   get/set fs readahead -A   get/set the drive look-a

Linux 系统裁剪笔记 4 (内核配置选项及删改)

在menuconfig中配置,可以对进行Linux内核配置选项及删改.本文介绍详细配置方法.第一部分:全部删除Code maturity level options ---> 代码成熟等级选项[]Prompt for development and/or incomplete code/drivers 默认情况下是选择的,这将会在设置界面中显示还在开发或者还没有完成的代码与驱动.不选.第二部分 :除以下选项,其它全部删除General setup-〉System V IPC (IPC:Inter

Gentoo系统安装步骤详解

  网上教程这么多或者说,网上那么多资源你还写什么?主要是技术更新换代太快,有好多东西一直在变,所以我写出来最新的,肯定能让你安装成功的~ 下载镜像 一般我都是用国内的镜像源,不管是centos,ubuntu还是gentoo在国内的镜像来说肯定比国外快 代码如下: #下载地址 mirrors.163.com/gentoo/ #我用的x86的 http://mirrors.163.com/gentoo/releases/x86/current-iso/ #需要下载,举个国内最新版本,这个地址htt