- Регистрация
- 24 Окт 2019
- Сообщения
- 45
- Реакции
- 24
apt install hdparm
apt install bc
apt install bc
Bash:
#!/bin/bash
#
# Script to test SSD disk speed and give an average rating
echo "Testing SSD disk speed..."
echo ""
# Run hdparm command to test read speed
hdparm -t /dev/sda > speedtest.txt
# Extract speed from result and print to console
read_speed=$(cat speedtest.txt | awk '/Timing buffered/ {print $5}')
echo "Read speed: $read_speed MB/s"
# Calculate rating based on speed
rating=""
if (( $(echo "$read_speed < 200" |bc -l) )); then
rating="Poor"
elif (( $(echo "$read_speed < 400" |bc -l) )); then
rating="Average"
else
rating="Excellent"
fi
# Print rating to console
echo "Disk rating: $rating"
# Clean up
rm speedtest.txt