Command: hdparm-t device name (/dev/sda1)
Write speed command: time dd if =/dev/zero of =/tmp/test. dat bs = 1G count = 1
Test disk read/write IO speed
Sometimes, during maintenance, we always encounter a problem similar to IO, but it cannot be determined whether it is an I/O bottleneck or a hot disk caused by improper configuration of software parameters. at this time, we usually want to know the read/write speed of the disk for further decision-making.
The following are two test methods:
(1) Use the hdparm command
This is a command used to obtain the parameters of the ATA/IDE hard disk, hdparm has been written by Mark Lord, the primary developer and maintainer of the (E) IDE driver for Linux, with suggestions from javasnetfolk ). this command should also be used only for Linux systems. For UNIX systems, ATA/IDE Hard Disks may be used less often. Generally, large systems use disk arrays.
Easy to use
# Hdparm-Tt/dev/sda
/Dev/sda:
Timing cached reads: 6676 MB in 2.00 seconds = 3340.18 MB/sec
Timing buffered disk reads: 218 MB in 3.11 seconds = 70.11 MB/sec
We can see that the 6-3340.18 MB cache is read in 2 seconds, which is about MB/sec;
3.11 MB disk read (physical read) in 70.11 seconds, the read speed is about MB/sec
(2) Use the dd command
This is not a professional test tool. However, if the test results are not demanding, you can use it to evaluate the disk read/write speed.
In addition, this is a free software, which is basically installed on x nix systems. dd tools are generally the first choice for copying and migrating Oracle bare devices.
Learn about two special devices before use
/Dev/null pseudo device, recycle bin. Writing this file will not generate IO
The/dev/zero pseudo device will generate an empty producer stream and will not generate IO for it.
Test method:
A. Test the disk I/O write speed.
# Time dd if =/dev/zero of =/test. dbf bs = 8 k count = 300000
300000 + 0 records in
300000 + 0 records out
10.59 s real 0.43 s user 9.40 s system
# Du-sm/test. dbf
2347/test. dbf
As you can see, in 10.59 seconds, a file of 2 MB is generated, and the IO write speed is about 221.6 MB/sec;
Of course, this speed can be tested several times to obtain an average value, which is consistent with the probability statistics.
B. Test the disk I/O read speed.
# Df-m
Filesystem 1M-blocks Used Available Use % Mounted on
/Dev/mapper/VolGroup00-LogVol00
19214 9545 8693 53%/
/Dev/sda1 99 13 82 14%/boot
None 506 0 506 0%/dev/shm
# Time dd if =/dev/mapper/VolGroup00-LogVol00 of =/dev/null bs = 8 k
2498560 + 0 records in
2498560 + 0 records out
247.99 s real 1.92 s user 48.64 s system
The above test reads 247.99 MB of files in 77.48 seconds, and the average speed is MB/sec.
C. Test the speed of simultaneous IO reading and writing
# Time dd if =/dev/sda1 of = test. dbf bs = 8 k
13048 + 1 records in
13048 + 1 records out
3.73 s real 0.04 s user 2.39 s system
# Du-sm test. dbf
103 test. dbf
The data volume tested above is small and serves as a reference only.
Compared to the following two methods:
The former is a professional IDE/ATA disk testing tool on linux, But the use range is limited. (This test only uses the disk IO test parameters, for other parameters and explanations, refer to man's Manual)
The latter can be used for general purposes, but it is not professional enough and does not take into account the distinction between cache and physical read. The test data is also for reference only and cannot be regarded as authoritative.
Test hard disk read/write speed in Linux
Linux hard disk Detection