Skip to content

Instantly share code, notes, and snippets.

@davlgd
Last active February 27, 2024 23:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davlgd/f2863c0f3cbb5669b7bdf499fe43d870 to your computer and use it in GitHub Desktop.
Save davlgd/f2863c0f3cbb5669b7bdf499fe43d870 to your computer and use it in GitHub Desktop.
Benchmark HDD in batch using ioping
#!/bin/bash
if ! command -v ioping &> /dev/null; then
echo "Error: ioping is not installed."
exit 1
fi
root_disk=$(df / | grep '/' | awk '{print $1}' | sed 's/[0-9]*//g')
disks=$(ls /dev/sd* | grep -E "/dev/sd[a-z]$" | grep -v "$root_disk")
if [ -z "$disks" ]; then
echo "Error: No hard drives found."
exit 1
fi
for disk in $disks; do
echo "$disk :"
echo "=========="
sudo ioping -ADLq -a 5 -c 30 -s 8M -S 1G $disk | head -n +3 | tail -n 1
sudo ioping -ADLWWWq -a 5 -c 30 -s 8M -S 1G $disk | head -n +3 | tail -n 1
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment