Linux下用hdparm测试磁盘性能遇到“Inappropriate ioctl for
1) 工具描述
hdparm是用来测试硬盘读性能的常用工具. 系统自带的hdparm版本比较老, 在某些服务器里(如HP Proliant系列)执行会有如下错误:
"HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device".
查看系统自带hdparm命令的版本:
# hdparm -V
hdparm v5.7
# which hdparm
/sbin/hdparm
2) 下载安装
下载地址: http://sourceforge.net/projects/hdparm/files/
# cd /orahome/wangnc/os
# rz (二进制上传新版文件hdparm-9.9.tar.gz)
# tar zxvf hdparm-9.9.tar.gz
# cd hdparm-9.9
# make
# make install
3) 使用示例
系统自带旧版本会有如下错误提示:
# hdparm -V
hdparm v5.7
# hdparm -tT /dev/cciss/c0d1p3
/dev/cciss/c0d1p3:
Timing cached reads: 11484 MB in 2.00 seconds = 5745.75 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device
Timing buffered disk reads: 122 MB in 3.07 seconds = 39.72 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device
使用新版本后不会有错误提示了:
# hdparm -V
hdparm v9.9
# hdparm -tT /dev/cciss/c0d1p3
/dev/cciss/c0d1p3:
Timing cached reads: 5724 MB in 2.00 seconds = 2863.87 MB/sec
Timing buffered disk reads: 194 MB in 3.01 seconds = 64.48 MB/sec
其中两参数含义:
-T perform cache read timings显示了不存取磁盘直接从Linux缓存读取数据的速度. 这项测量实际上标示了被测系统的处理器,缓存和内存的吞吐量.
-t perform device read timings显示了不使用预先的数据缓冲, 标示了Linux下没有任何文件系统开销时磁盘可以支持多快的连续数据读取.
--End--