New script using smartctl. Grabs firmware now as well.
#!/bin/bash
hd=$(lsblk -dpno KNAME -I 3,8,9,179,202,253,259 | uniq | sort -V | head -1)
#FOG expects the string in the following format
##Model=ST31500341AS, FwRev=CC1H, SerialNo=9VS34TD2
disk_info=$(smartctl -i $hd)
model=$(echo "${disk_info}" | sed -n 's/.*\(Model Number\|Device Model\):[ \t]*\(.*\)/\2/p')
sn=$(echo "${disk_info}" | sed -n 's/.*Serial Number:[ \t]*\(.*\)/\1/p')
firmware=$(echo "${disk_info}" | sed -n 's/.*Firmware Version:[ \t]*\(.*\)/\1/p')
hdinfo="Model=${model}, iFwRev=${firmware}, SerialNo=${sn}"
echo $hdinfo
This works for NVMe and SATA. Note that SATA drives use a ‘Device Model’ where as NVMe drives use ‘Model Number’. This could lead to issues if other drives report it differently.