Skip to content

Instantly share code, notes, and snippets.

@keuv-grvl
Created February 21, 2023 09:02
Show Gist options
  • Save keuv-grvl/3dff29086d8bdad985bddcfccc27dd8b to your computer and use it in GitHub Desktop.
Save keuv-grvl/3dff29086d8bdad985bddcfccc27dd8b to your computer and use it in GitHub Desktop.
Benchmark device (write) speed

Benchmark write speed

Write zeros to a device (using a mountpoint).

Command

# Choose one
FOLDER="$HOME"
FOLDER="/tmp"
FOLDER="/mnt/your/sata/disk"
FOLDER="/dev/shm"  # this is your RAM

dd if=/dev/zero of="${FOLDER}/bench" bs=384k count=1k conv=fdatasync; rm -f "${FOLDER}/bench"

You may adjust the count for better estimation.

Sample output

4026531840 bytes (4.0 GB, 3.8 GiB) copied, 21.2701 s, 189 MB/s

Notes

  • Ensure you don't have a bench that could be overridden
  • Ensure you have enough disk space (here bs * count bytes)
  • From dd manual:

    fdatasync physically write output file data before finishing

  • Check lsblk for mountpoints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment