From b4b886d7ce14a8ef156b2ae286445c85963fb25a Mon Sep 17 00:00:00 2001 From: Keith Nash Date: Wed, 5 Aug 2020 23:11:46 -0500 Subject: [PATCH] Modify to discover older SATA drives Modified algorithm to detect older SATA drives that don't return the SATA version when queried. --- smart_report.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/smart_report.sh b/smart_report.sh index 51db6e2..8c44f74 100644 --- a/smart_report.sh +++ b/smart_report.sh @@ -38,12 +38,21 @@ get_smart_drives() done } -# Get list of SATA disks +# Get list of SATA disks, including older drives that only report an ATA version get_sata_drives() { for drive in $Drive_list; do + lFound=0 gsata_smart_flag=$("$smartctl" -i "$drive" | grep -E "SATA Version is:[[:blank:]]" | awk '{print $4}') if [ "$gsata_smart_flag" = "SATA" ]; then + lFound=$((lFound + 1)) + else + gsata_smart_flag=$("$smartctl" -i "$drive" | grep -E "ATA Version is:[[:blank:]]" | awk '{print $1}') + if [ "$gsata_smart_flag" = "ATA" ]; then + lFound=$((lFound + 1)) + fi + fi + if [ $lFound -gt 0 ]; then SATA_list="$SATA_list $drive" SATA_count=$((SATA_count + 1)) fi