Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to test hard disk performance with dd command

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "dd command how to test hard disk performance", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "dd command how to test hard disk performance" bar!

Let's directly introduce several common DD commands. Let's take a look at their differences.

Dd bs=64k count=4k if=/dev/zero of=test

Dd bs=64k count=4k if=/dev/zero of=test; sync

Dd bs=64k count=4k if=/dev/zero of=test conv=fdatasync

Dd bs=64k count=4k if=/dev/zero of=test oflag=dsync

The difference between these four DD commands lies in the way the write cache is handled in memory.

1.

Dd bs=64k count=4k if=/dev/zero of=test

No parameters are added, and the default mode of dd does not include the "sync" command. In other words, the dd command does not actually ask the system to write the file to disk until it is completed. So the above command simply reads the 128MB data into the memory buffer (write cache [write cache]). So what you get is a super fast speed. Because in fact, dd only gives you read speed, and the system doesn't really write data to disk until dd is completed, but you can't see this speed. So if it's fast, it won't work.

Actual running results:

268435456 bytes (268MB) copied, 1.3529 seconds, 198MB/s

two。

Dd bs=64k count=4k if=/dev/zero of=test; sync

It's exactly the same as in the previous one. The semicolon is separated by only two separate orders. When the sync command is ready to actually write data to disk, the previous dd command has already displayed the wrong "write speed" value on the screen. So you still can't get the real write speed.

Actual running results:

268435456 bytes (268 MB) copied, 0.522815 seconds, 513 MB/s

3.

Dd bs=64k count=4k if=/dev/zero of=test conv=fdatasync

After adding this parameter, the dd command will actually perform a "sync" operation in the end, so what you get at this time is the time it takes to read the 128m data into memory and write it to disk, so the calculated time is more in line with the actual results.

Actual running results:

268435456 bytes (268MB) copied, 2.8046 seconds, 95.7MB/s

4.

Dd bs=64k count=4k if=/dev/zero of=test oflag=dsync

When this parameter is added, dd performs synchronous write operations every time it executes. In other words, each time the command reads 64k, it first writes the 64k to disk, and then reads the following 64k for a total of 128 times. This is probably the slowest way, because write caching (write cache) is basically not used.

Actual running results:

268435456 bytes (268MB) copied, 3.40069 seconds, 78.9MB/s

Generally speaking, the fourth method is the most stringent, which can simulate the insertion operation of the database, so it is very slow, and it is also used to test the vps hard disk performance standard. generally speaking, the test results, if more than 10m, have no impact on the normal construction of the station. More than 50m, it is a very powerful state, saw the performance of this vps hard disk is very good, DD speed reached 78.9MB/s.

In these commands, bs=64k indicates that the block size that is read / output at the same time is 64k bytes, and count=4k indicates that the number of copied blocks is 4000. If the test is more stringent, we run DD with 1G of data:

Dd if=/dev/zero of=test bs=64k count=16k oflag=dsync

Indicates that each block size is 64k bytes, and the number of blocks tested is 16k. The actual test results:

1073741824 bytes (1.1 GB) copied, 18.9098 seconds, 56.8 MB/s

Thank you for your reading, the above is the "dd command how to test hard disk performance" content, after the study of this article, I believe you on the dd command how to test hard disk performance of this problem has a deeper understanding, the specific use of the need for you to practice verification. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report