Operations 5 min read

Which dd Command Gives the Most Accurate Disk Write Speed Test?

This article explains how different dd command variations affect disk write‑cache handling and why using the conv=fdatasync option yields the most reliable measurement of actual disk write performance.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Which dd Command Gives the Most Accurate Disk Write Speed Test?

Question: What are the differences among several ways to test disk read/write speed with dd?

Basic command (no sync)

dd bs=1M count=128 if=/dev/zero of=test

Without any additional parameters, dd does not invoke a synchronous write. The data is written to the page cache, so the reported speed reflects only memory throughput, not the real disk write speed.

Command followed by sync

dd bs=1M count=128 if=/dev/zero of=test; sync

The semicolon separates two independent commands. dd finishes first, showing a fast speed that only measures cached writes. The subsequent sync forces the data to be flushed to disk, but the speed shown by dd does not include this operation.

Using conv=fdatasync

dd bs=1M count=128 if=/dev/zero of=test conv=fdatasync

With the conv=fdatasync flag, dd performs a synchronous write at the end of the transfer, so the measured time includes the actual disk write, providing a more realistic speed.

Using oflag=dsync

dd bs=1M count=128 if=/dev/zero of=test oflag=dsync

The oflag=dsync option forces a synchronous write after each block. Each 1 MiB block is written to disk before the next block is read, making this the slowest method because it bypasses the write cache entirely.

Recommended method

For a practical and comparable measurement, use: dd bs=1M count=128 if=/dev/zero of=test conv=fdatasync This approach closely mirrors real‑world disk operations, yielding data that is most useful for performance analysis.

Additional notes

When testing, ensure the test file is much larger than available memory and consider setting a small memory cache at boot to avoid misleadingly high speeds.

Example write test: dd if=/dev/zero of=test.bin bs=4096 count=1M conv=fdatasync Example read test:

dd if=test.bin of=/dev/zero bs=4096 count=1M iflag=direct
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxDisk PerformanceddI/O testing
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.