Dd command: Test hard disk I/O performance

Source: Internet
Author: User

Dd command: Test hard disk I/O performance

I. dd replication and conversion

1. dd: convert and copy a file conversion and replication, bottom layer (Block) of the copy operation)

DESCRIPTION: Copy a file, converting and formatting according to the operands.

2. Usage: dd [OPTION] if =/PATH/FROM/SRC of =/PATH/TO/DEST

If =: the path is the source target path.

Of =: the location to be copied. The target path

[OPTION]

Bs = #: block size, the size of the replication unit. The default unit is byte;

Count = #: How many bs are copied;

3. Disk copy: dd if =/dev/sda of =/dev/sdb

4. MBR backup and damage

Backup MBR: dd if =/dev/sda of =/tmp/mbr. bak bs = 512 count = 1

Damage MBR Partition Table: dd if =/dev/zero of =/dev/sda bs = 512 count = 1

Destroy bootloader in MBR: dd if =/dev/zero of =/dev/sda bs = 256 count = 1

The first 446 bytes are the space occupied by the bootloader. Therefore, the entire damaged part will be damaged.

5. Two special devices:/dev/zero and/dev/null

/Dev/zero)

/Dev/null: data black hole; similar to recycle bin

Ii. dd hard disk I/O performance test

Several common DD commands: the difference lies in the way in which the cache is written in the memory.

Dd bs = 128 k count = 10 k if =/dev/zero of = test

Dd bs = 128 k count = 10 k if =/dev/zero of = test; sync

Dd bs = 128 k count = 10 k if =/dev/zero of = test conv = fdatasync

Dd bs = 128 k count = 10 k if =/dev/zero of = test oflag = dsync

WKioL1Z1KgGDda7VAABTcGLbp9w514.png

1. dd bs = 128 k count = 10 k if =/dev/zero of = test

(1) by default, the "sync" command is not included in the dd command. Before the dd command is completed, the system did not actually write the file to the disk.

(2) simply read data to the memory buffer (write cache [write cache])

(3) only the read speed is displayed, and the system does not actually write data to the disk until dd is complete.

Actual running result:

2. dd bs = 128 k count = 10 k if =/dev/zero of = test; sync

(1) only two independent commands are separated by semicolons (;).

(2) The dd command has displayed the "write speed" value on the screen, and cannot get the real write speed.

Actual running result:

3. dd bs = 128 k count = 10 k if =/dev/zero of = test conv = fdatasync

(1) After the dd command is executed, a "sync" operation will be executed.

(2) The time required to read the M data to the memory and write the data to the disk.

(3) comparison with actual conditions

Actual running result:

4. dd bs = 128 k count = 10 k if =/dev/zero of = test oflag = dsync

(1) dd performs synchronous write operations every time it is executed.

(2) write the 128 k to the disk after each k read, and then read the following k

(3) the slowest way, basically not using the write cache)

Actual running result:

The fourth method is the strictest. It can simulate database insert operations, so it is very slow.

It is also used to test the performance standard of the vps hard disk. Generally, if the test result is over 10 MB, it will not affect normal website construction. If it is over 50 MB, it will be very good.

In addition, the test damages the hard disk.

This article permanently updates the link address:

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.