>linux Server installed the system, want to know whether the hard disk read and write to meet the needs of the service, if not meet the hard disk IO is a bottleneck of the service. So we need to test the hard disk read and write speed, testing a lot of methods, the following is the use of Linux with the DD command to test the read and write speed of the hard disk.
Time has a timing function, DD is used for copying, read from If, write to of. If=/dev/zero does not produce IO, so it can be used to test write speed. Similarly of=/dev/null does not produce IO and can be used to test the read speed. BS is the size of each read or write, that is, the size of a block, and count is the number of read and write blocks.
Write speed of the disk on which the/data directory resides:
[[Email protected] ~]# time DD If=/dev/zero of=/var/test bs=8k count=1000000
1000000+0 Records in
1000000+0 Records out
8192000000 bytes (8.2 GB) copied, 52.5749 seconds, 156 MB/s
Real 0m55.841s
User 0m0.507s
SYS 0m15.706s
# #红色部分是因为使用了time命令才显示的, so the time command is required to calculate when the replication takes.
The/data directory contains the disk read-only speed:
[[Email protected] ~]# time DD if=/var/test of=/dev/null bs=8k count=1000000
1000000+0 Records in
1000000+0 Records out
8192000000 bytes (8.2 GB) copied, 49.0088 seconds, 167 MB/s
Real 0m49.025s
User 0m0.559s
SYS 0m6.383s
Test read/write speed:
[[Email protected] ~]# time DD if=/var/test of=/tmp/test bs=8k count=1000000
125000+0 Records in
125000+0 Records out
8192000000 bytes (8.2 GB) copied, 129.239 seconds, 63.4 MB/s
Real 2m9.251s
User 0m0.114s
SYS 0m21.494s
Looks like the test results are good, hey
Note: Theoretically, the greater the amount of replication, the more accurate the test results.
The normal test may be more than one side of the test, it may take a lot of times to find the average, this test results in normal redirection is not effective after Google a bit in the following way to redirect to a file
DD If=/dev/zero of=/var/test bs=8k count=1000000 2>> Info
The result of this test is in the info file.
Hdparm test Drive Read and write speed
Installation: Yum Install Hdparm
syntax: hdparm [-cfghiiqttvyyz][-a < cache partition >][-a < 0 or 1 > ][-c <i/o mode >][-d < 0 or 1 >][-k < 0 or 1 >][-k < 0 or 1 >][-m < partition number >][-n < 0 or 1 >][-p <pio mode >][-p < partition number >][-r < 0 or 1 >][-s < time >][-u < 0 or 1 ;] [-W < 0 or 1 ;] [-X < transfer mode;] [Device] |
补充说明:hdparm可检测,显示与设定IDE或SCSI硬盘的参数。 |
-a<快取分区> 设定读取文件时,预先存入块区的分区数,若不加上<快取分区>选项,则显示目前的设定。 |
-i 显示硬盘的硬件规格信息,这些信息是在开机时由硬盘本身所提供。 |
-k< 0 或 1 > 重设硬盘时,保留-dmu参数的设定。 |
-K< 0 或 1 > 重设硬盘时,保留-APSWXZ参数的设定。 |
-q 在执行后续的参数时,不在屏幕上显示任何信息。 |
-u< 0 或 1 > 在硬盘存取时,允许其他中断要求同时执行。 |
To test the read speed of the hard drive:
Normal disk test:
Timing buffered disk reads: 316 MB in 3.02 seconds = 104.71 MB/sec |
Timing cached reads: 19328 MB in 1.99 seconds = 9691.24 MB/sec |
RAID0 Test (two disks):
Timing buffered disk reads: 622 MB in 3.01 seconds = 206.89 MB/sec |
Timing cached reads: 19632 MB in 1.99 seconds = 9844.20 MB/sec |
RAID0 Test (three disks):
Timing buffered disk reads: 846 MB in 3.00 seconds = 281.54 MB/sec |
Timing cached reads: 18412 MB in 1.99 seconds = 9229.67 MB/sec |
RAID0 test (four plates)
Timing cached reads: 19608 MB in 1.99 seconds = 9832.76 MB/sec |
Timing buffered disk reads: 860 MB in 3.00 seconds = 286.35 MB/sec |
In addition arid card test speed, each time will be warned:
HDIO_DRIVE_CMD( null ) (wait for flush complete) failed: Inappropriate ioctl for device |
Reference test speed Method: Time Cp-a data2 data2
This article is from "Rain" blog, be sure to keep this source http://gushiren.blog.51cto.com/3392832/1691877
Linux uses the DD command to test hard disk read and write speeds