A cross-platform disk benchmark tool written in Rust, inspired by the original disk-bench.sh script.
- Cross-Platform: Works on Windows, Linux, and macOS.
- Buffered & Unbuffered I/O:
- Buffered: Uses OS page cache (default). Good for testing cached performance.
- Unbuffered (
--no-buffer): Bypasses OS cache usingO_DIRECT(Linux) orFILE_FLAG_NO_BUFFERING(Windows). Good for testing raw disk performance.
- Customizable: Set iterations, file size, speed unit.
- Safety: Automatically cleans up test files even if the program is interrupted (best effort).
disk_bench [ITERATIONS] [SIZE] [SPEED_UNIT] [CLEAR_CACHE] [DESTINATION_PATH] [OPTIONS]ITERATIONS: Number of test iterations.SIZE: File size (e.g.,1G,500M,100MiB).SPEED_UNIT: Display unit (K,M,G).CLEAR_CACHE:yesorno(clears OS cache before read test).- Note: On Windows, this only flushes file buffers. On Linux/macOS, it attempts to drop caches (requires root).
DESTINATION_PATH: Directory to run the test in (default: home directory).
--no-buffer: Use direct I/O (bypass cache).-h, --help: Print help.
Run 3 iterations, 1GB file, display in MBps, buffered:
disk_bench 3 1G M no .Run 1 iteration, 500MB file, unbuffered (raw disk speed):
disk_bench 1 500M M no . --no-buffercd disk_bench
cargo build --releaseThe binary will be in disk_bench/target/release/disk_bench.