Difference between revisions of "Run SMART test on all SATA drives"

From Michael's Information Zone
Jump to navigation Jump to search
(Created page with "<pre> #!/bin/bash ##Create list of all possible sata block devices for i in {a..z} do echo sd$i >> /tmp/drivelist done ##Check if the drive exists, if it does run the long sma...")
 
(No difference)

Latest revision as of 16:44, 7 August 2016

#!/bin/bash
##Create list of all possible sata block devices
for i in {a..z}
do
echo sd$i >> /tmp/drivelist
done
##Check if the drive exists, if it does run the long smart test.
while read line
do
smartctl -H /dev/$line > /tmp/asdasd
if grep -q "No such device" /tmp/asdasd; then
rm -f /tmp/asdasd
else
rm -f /tmp/asdasd
smartctl -t long /dev/$line &> /dev/null
fi
done < /tmp/drivelist
rm /tmp/drivelist