Test the disk read/write speed in Linux

Source: Internet
Author: User

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. It was written by Mark lord, an early developer of the Linux ide Driver (hdparm has been written by Mark lord, the primary
Developer and maintainer of the (e) ide driver for Linux, with suggestions from many netfolk ). 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.