Yes, there are alternatives to the command:
pv --rate-limit 100M -s {size_gb}G < /dev/zero | dd of={drive_path} bs=1M status=none conv=fsync
This command essentially writes a specific amount of zeroed data to a drive at a controlled speed (100 MB/s), using pv for rate limiting and progress monitoring, and dd to write the output with syncing.
✅ Alternative 1: Use dd alone with ionice / pv or cpulimit
You can use dd alone, but you'll need an external tool like pv, ionice, or cpulimit to limit the I/O or CPU usage if needed.
Example:
dd if=/dev/zero of={drive_path} bs=1M count={size_gb} conv=fsync
- Replace
{size_gb} with the number of megabytes (count=1024 for 1GB).
- This doesn't include a rate limit, though. For that:
Add rate-limiting with pv (cleaner version):
dd if=/dev/zero bs=1M count={size_gb} | pv -L 100m | dd of={drive_path} bs=1M conv=fsync
Or better yet:
pv -L 100m -s ${size_gb}G /dev/zero > {drive_path}
That’s much simpler and does the same thing!
✅ Alternative 2: Use pv directly
As mentioned above, this is more efficient:
pv -L 100m -s {size_gb}G < /dev/zero > {drive_path}
-L 100m limits to 100 MB/s
-s sets the expected size for progress display
< /dev/zero reads zeros
> {drive_path} writes directly to the device
This avoids dd entirely and still gives you control over speed and progress.
✅ Alternative 3: Use fio for advanced control
If you want even more control over I/O behavior (like direct I/O, sync, block size, etc.), consider fio.
Example:
fio --name=write_zeros --filename={drive_path} \
--bs=1m --rw=write --size={size_gb}G \
--rate=100m --direct=1 --sync=1 --time_based --runtime=0
--rate=100m limits bandwidth
--direct bypasses page cache
--sync ensures data is flushed
- You get detailed performance stats too
✅ Summary of Alternatives
| Tool | Pros | Command Example |
|---|
pv | Simple, shows progress, supports rate-limit | pv -L 100m -s 10G /dev/zero > /dev/sdX |
dd + pv | More flexible, traditional approach | `dd if=... |
fio | Most powerful; advanced I/O tuning | fio --rw=write --rate=100m ... |
Let me know your goal (e.g., benchmarking, wiping a drive, testing I/O) and I can tailor the best alternative for your use case.