smartmontools (smartctl)

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
sudo $0
  exit
fi

apt-get install -y smartmontools --no-install-recommends
>

Show health from all SAS devices

for DISK in $(lsblk -S | grep sas | cut -d" " -f1); do
    smartctl -d scsi -H /dev/${DISK}
done

Enable SMART on device

sudo smartctl -s on /dev/sdb

Show device SMART Health status

sudo smartctl -H /dev/sda

Show device selftest log

smartctl -l selftest /dev/sdb

Get info from usb data

sudo smartctl -d sat -a /dev/sdb

Test

smartctl -t short /dev/sdb
smartctl -t offline /dev/sdb

Calculate total writen GB from a SSD

echo "Total GB written: $(echo "scale=3; $(sudo /usr/sbin/smartctl -A /dev/sda | grep "Total_LBAs_Written" | awk '{print $10}') * 512 / $((1024*1024*1024))" | bc)"

SAT pass-through Linux UAS blacklisting

lsusb  | grep Seagate
echo "0x0bc2:0xab28:u" | sudo  tee > /sys/module/usb_storage/parameters/quirks
smartctl -a /dev/sdd
smartctl -a -d sat  /dev/sdd

Links
https://www.smartmontools.org/wiki/Supported_USB-Devices