fast check all drives smart state
#!/usr/bin/env bash
echo "S.M.A.R.T. drives state:"
let x=0
#for disk in $(ls -l /dev/disk/by-path | egrep -v usb | egrep -v part | sed 's/^.*pci/pci/' | sed 's/\s.*$//')
for disk in $(ls -l /dev/disk/by-path | grep -e ata -e sas -e nvme | egrep -v part | sed 's/^.*pci/pci/' | sed 's/\s.*$//')
do
SN=$(smartctl --all /dev/disk/by-path/$disk | grep 'Serial Number')
SMART_STATE=$(smartctl --all /dev/disk/by-path/$disk | grep 'SMART overall-health self-assessment test result')
CAPACITY=$(smartctl --all /dev/disk/by-path/$disk | grep 'Capacity')
echo " disk № $x: $disk"
echo " $SN"
echo " $SMART_STATE"
echo " $CAPACITY"
let x=x+1
done
Содержание