Creating Test Files with dd: A Quick Way to Gauge Storage Performance
Need a fast way to kick the tires on your storage setup or see how a new filesystem behaves under load? There’s a classic trick that works like a charm for generating a predictable file of any size, perfect for ad hoc benchmarking or stress testing. Enter dd—one of those unassuming utilities that quietly gets the job done with brutal efficiency.
What we’re doing here is using dd to write a fixed amount of data, straight from /dev/zero, into a file. The idea is simple: fill a file with zeroes, large enough to simulate a realistic workload, and use that to test read/write speeds, observe disk behavior, or see how your system handles I/O under pressure.
Try this:
dd if=/dev/zero of=/tmp/testfile bs=1M count=1000This command writes 1,000 blocks of one megabyte each—exactly 1GB—of zeroes into /tmp/testfile. The source, /dev/zero, provides a stream of null bytes at the speed of light (well, almost), so the bottleneck here is purely your storage layer. Ideal for getting a baseline performance reading or watching how aggressive your write cache really is.
One thing to keep in mind: dd doesn’t report progress by default. If you want to see live stats (and who doesn’t?), you can add status=progress at the end to monitor throughput as it writes. Also, don’t forget to clean up after your test with rm /tmp/testfile unless you’re into clutter or enjoy the thrill of running out of disk space during an unrelated task.
This trick can be reversed too—use if=/tmp/testfile of=/dev/null to test read speeds. Or scale it up to simulate larger workloads. Just be sure /tmp points to real disk space and not a memory-backed filesystem like tmpfs, unless RAM speed is what you’re benchmarking (in which case: nice).
For quick, controlled, and repeatable disk tests, dd is still the old reliable.
Because sometimes, the fastest way to measure I/O is to just throw a gigabyte of zeroes at it.
About the author(s)
Johan Louwers is currently Chief Enterprise Architect for a large global tech company as well as the lead architect for NATO and a number of militaries. Johan has a strong and long background in the field of Enterprise Architecture and complex system engineering. Having worked with enterprises in a diverse set of industries as (enterprise) architect, CTO and technical and strategic business advisor Johan brings both deep technical knowledge to the table as well as strong business oriented expertise. In addition to this Johan is a tech addict who tends to enjoy supporting open source initiatives and actively coding as a hobby. Views expressed in this post are personnel and do not necessarily reflect the views of my current employer.

