Last active
February 27, 2024 23:36
-
-
Save davlgd/f2863c0f3cbb5669b7bdf499fe43d870 to your computer and use it in GitHub Desktop.
Benchmark HDD in batch using ioping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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