Skip to content

Instantly share code, notes, and snippets.

@jimmygle
Last active April 29, 2021 03:58
Show Gist options
  • Save jimmygle/565fd39d61645db1b360437623d53aeb to your computer and use it in GitHub Desktop.
Save jimmygle/565fd39d61645db1b360437623d53aeb to your computer and use it in GitHub Desktop.
Helpful one liners for testing drive performance
#!/bin/bash
# Writes zeroes to a drive and reports transfer rate
# From here: https://linuxhint.com/benchmark_hard_disks_linux/
cd /mnt/drive
dd if=/dev/zero of=benchfile bs=4k count=200000 && sync; rm benchfile
# Write & read performance
# Writes 1.6GB file to drive and then copies the file to another drive (should be SSD)
cd /mnt/drive
echo "READ\n"
dd if=/dev/zero of=benchfile bs=4k count=400000
echo "WRITE\n"
rsync -ah --progress benchfile ~/benchfile
rm benchfile && rm ~/benchfile
# Tests cache and block speed performance
hdparm -tT /dev/sdX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment