Test the disk read/write speed (I/O physical speed) in linux)

Source: Internet
Author: User

I. 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


Ii. 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.

First, learn about two special devices.

/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 if you want to test the actual speed, add oflag = direct at the end to test the actual IO speed.
    B. Test the disk I/O read speed.
      Dd if = test. dbf bs = 8 k count = 300000 of =/dev/null

    # Indicates that 8 K of data is written/read each time, and 300000 executions are performed.

Dd commands can be used in common scenarios, but they are not professional enough and do not take into account the distinction between cache and physical read. The test data is also For reference onlyIs not authoritative.

##########################

This method is used to test the write speed of a notebook I bought in at a speed of 23 M/s and a read Speed of 91 M/s.

##########################

Dd command explanation

Dd if = of = bs = skip = seek = conv =

Do not confuseSourceAndTargetOtherwise, data will be lost. Therefore, dd is usually called as dd, but it should be cried and called Data Destroyer if the Data is accidentally lost.

Generally, its common parameters include:

  • Bs = n, block size, which reads n bytes data each time and can be used with count;
    • Ibs = n, one bytes read (default is 512 );
    • Obs = n, writes n bytes at a time (default is 512 );
    • Bs can set the above two parameters at the same time;
    • Cbs = n, converts n bytes at a time, that is, the size of the conversion buffer .;
  • Count = n, number of bs operations, only n blocks are copied, such as dvd: bs = 1 M count = 4430;
  • Skip = n, indicating that the original file after if skips n bytes and then starts reading;
  • Seek = n, indicating that the target file after the object skips n bytes and starts writing;

    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
    500 test. dbf (a MB test. dbf file is generated when a colleague tests the read/write speed)

    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.

    If dd is used for testing, oflag = direct must be added. The actual disk io is measured.

Related Article

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.