Last active
September 19, 2019 20:45
-
-
Save flatlinebb/bed88ef4b057417ae18ac2ddc6be44eb to your computer and use it in GitHub Desktop.
Enable SMART on all drives.
Start short test on all drives.
Monitor test on all drives.
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
To enable SMART on a drive: | |
for sd in /dev/sd[a-f]; do echo $sd; smartctl --smart=on --offlineauto=on --saveauto=on $sd; done | |
For drives in USB enclosures, add the -d sat switch: | |
for sd in /dev/sd[a-z]; do echo $sd; smartctl --smart=on --offlineauto=on --saveauto=on -d sat $sd; done | |
To get the ERROR rate | |
for sd in /dev/sd[a-z]; do smartctl -A /dev/sdb | head -7| tail -1; smartctl -A /dev/sdb | grep Error_Rate | grep -v Multi | |
for sd in /dev/sd[a-e]; do echo $sd; smartctl -a $sd | grep Model ; smartctl -A $sd | head -7| tail -1; smartctl -A $sd | grep Error_Rate | grep -v Multi; done | |
To get error status for all drives: | |
for sd in /dev/sd[a-z]; do echo "Device Name: $sd"; smartctl -a $sd | grep Model; smartctl -A $sd | head -7 | tail -1; smartctl -A $sd | grep Serial Number; smartctl -A $sd | grep Error_Rate | grep -v Multi | grep -v G-Sense; smartctl -A $sd | grep Sector; echo ; done | |
To get error status for all drives, plus Serial Number: | |
for sd in /dev/sd[a-z]; do echo "Device Name: $sd"; smartctl -a $sd | grep Model; smartctl -a $sd | grep Serial; smartctl -A $sd | head -7 | tail -1; smartctl -A $sd | grep Error_Rate | grep -v Multi | grep -v G-Sense; smartctl -A $sd | grep Sector; echo ; done | |
To start short test on all drives: | |
for sd in /dev/sd[a-k]; do smartctl -t short $sd; done | |
execute as a script with watch: | |
watch -c -n 1 -d --exec test-status.sh | |
watch -c -n 1 -d --exec smart-test-status-all.sh | |
test-status.sh: | |
smartctl -c /dev/sde | grep status; smartctl -c /dev/sde | grep remaining | |
smart-test-status-all.sh: | |
for sd in /dev/sd[a-k]; do smartctl -c $sd | grep status; smartctl -c $sd | grep remaining; done | |
for sd in /dev/sd[a-z]; do echo $sd; smartctl -c $sd | grep Self-test | grep -v supported; smartctl -c $sd | grep remaining; done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment