diff --git a/driveAtlas.sh b/driveAtlas.sh index ae2e585..a9bccb8 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -175,8 +175,9 @@ get_drive_smart_info() { local type=$(echo "$smart_info" | grep "Rotation Rate" | grep -q "Solid State" && echo "SSD" || echo "HDD") local health=$(echo "$smart_info" | grep "SMART overall-health" | grep -q "PASSED" && echo "✓" || echo "✗") local model=$(echo "$smart_info" | grep "Device Model\|Model Number" | cut -d: -f2 | xargs) + local serial=$(echo "$smart_info" | grep "Serial Number" | awk '{print $3}') - echo "$type|$temp°C|$health|$model" + echo "$type|$temp°C|$health|$model|$serial" } #------------------------------------------------------------------------------ @@ -211,16 +212,16 @@ esac #------------------------------------------------------------------------------ echo -e "\n=== Drive Details with SMART Status ===" -printf "%-15s %-10s %-8s %-8s %-8s %-30s\n" "DEVICE" "SIZE" "TYPE" "TEMP" "HEALTH" "MODEL" -echo "--------------------------------------------------------------------------------" +printf "%-15s %-10s %-8s %-8s %-8s %-30s %-20s\n" "DEVICE" "SIZE" "TYPE" "TEMP" "HEALTH" "MODEL" "SERIAL" +echo "----------------------------------------------------------------------------------------------------------------------------" # SATA/SAS drives lsblk -d -o NAME | grep -v "nvme" | grep -v "rbd" | grep -v "loop" | grep -v "NAME" | while read device; do if [ -b "/dev/$device" ]; then size=$(lsblk -d -n -o SIZE "/dev/$device" 2>/dev/null) smart_info=$(get_drive_smart_info "$device") - IFS='|' read -r type temp health model <<< "$smart_info" - printf "%-15s %-10s %-8s %-8s %-8s %-30s\n" "/dev/$device" "$size" "$type" "$temp" "$health" "$model" + IFS='|' read -r type temp health model serial <<< "$smart_info" + printf "%-15s %-10s %-8s %-8s %-8s %-30s %-20s\n" "/dev/$device" "$size" "$type" "$temp" "$health" "$model" "$serial" fi done @@ -229,9 +230,9 @@ if command -v nvme >/dev/null 2>&1; then nvme_drives=$(sudo nvme list 2>/dev/null | grep "^/dev") if [ -n "$nvme_drives" ]; then echo -e "\n=== NVMe Drives ===" - printf "%-15s %-10s %-10s %-40s\n" "DEVICE" "SIZE" "TYPE" "MODEL" - echo "--------------------------------------------------------------------------------" - echo "$nvme_drives" | awk '{printf "%-15s %-10s %-10s %-40s\n", $1, $6, "NVMe", $3}' + printf "%-15s %-10s %-10s %-40s %-20s\n" "DEVICE" "SIZE" "TYPE" "MODEL" "SERIAL" + echo "----------------------------------------------------------------------------------------------------------------------------" + echo "$nvme_drives" | awk '{printf "%-15s %-10s %-10s %-40s %-20s\n", $1, $6, "NVMe", $3, $2}' fi fi