Skip to content

Instantly share code, notes, and snippets.

@bergpb
Created November 25, 2022 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergpb/a286b792cc762d3487a6430c53707657 to your computer and use it in GitHub Desktop.
Save bergpb/a286b792cc762d3487a6430c53707657 to your computer and use it in GitHub Desktop.
Test disk speed using dd
#!/bin/bash
local=$1
size=$2
if [[ ! -n $local ]]; then
echo "Variable local not set, default will be /tmp/test_disk_speed"
local='/tmp/test_disk_speed'
fi
if [[ ! -n $size ]]; then
echo "Variable size not set, default will be 1000"
size=500
fi
echo "Testing writing speed..."
sync; dd if=/dev/zero of=$local bs=1M count=$size; sync
echo "Testing reading speed..."
sync; dd if=$local of=/dev/zero bs=1M count=$size; sync
rm $local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment