Browse Source

Update drive_info.sh

test
Dave Russell 3 years ago
committed by GitHub
parent
commit
408d1c5fdb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      drive_info.sh

19
drive_info.sh

@ -6,7 +6,7 @@ for d in $(cat /proc/partitions | awk '{print $4}'); do
fi
#echo $d # debug
case "$d" in
sd*)
sd*|hd*)
if [[ $d =~ [hs]d[a-z]$ ]]; then
echo -e "\n$d" # debug
hdmodel=$(smartctl -i "/dev/$d" | grep -i "Device Model:" | awk '{print $3 $4 $5}')
@ -22,6 +22,22 @@ for d in $(cat /proc/partitions | awk '{print $4}'); do
echo "Firmware: '$fwrev'" # debug
fi
;;
sata*|sas*)
if [[ $d =~ (sas|sata)[0-9][0-9]?[0-9]?$ ]]; then
echo -e "\n$d" # debug
hdmodel=$(smartctl -i "/dev/$d" | grep -i "Device Model:" | awk '{print $3 $4 $5}')
if [[ ! $hdmodel ]]; then
hdmodel=$(smartctl -i "/dev/$d" | grep -i "Product:" | awk '{print $2 $3 $4}')
fi
echo "Model: '$hdmodel'" # debug
fwrev=$(smartctl -i "/dev/$d" | grep -i "Firmware Version:" | awk '{print $3}')
if [[ ! $fwrev ]]; then
fwrev=$(smartctl -i "/dev/$d" | grep -i "Revision:" | awk '{print $2}')
fi
echo "Firmware: '$fwrev'" # debug
fi
;;
nvme*)
if [[ $d =~ nvme[0-9][0-9]?n[0-9][0-9]?$ ]]; then
echo -e "\n$d" # debug
@ -37,7 +53,6 @@ for d in $(cat /proc/partitions | awk '{print $4}'); do
nvmefw=$(echo "$nvmefw" | xargs) # trim leading and trailing white space
echo "NVMe Firmware: '$nvmefw'" # debug
fi
;;
esac

Loading…
Cancel
Save