Add storage-01 mapping and fix NVMe serial display
- Add PCI path mappings for storage-01 (4 SATA drives on AMD controller) - Fix NVMe serial: use smartctl instead of nvme list for accurate serial numbers - NVMe now shows actual serial number instead of /dev/ng device path Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -132,9 +132,13 @@ declare -A SERVER_MAPPINGS=(
|
|||||||
"
|
"
|
||||||
|
|
||||||
# storage-01
|
# storage-01
|
||||||
# Different motherboard, no HBA currently
|
# Motherboard: ASRock A320M-HDV R4.0 with AMD SATA controller at 02:00.1
|
||||||
# TODO: Map actual PCI paths after running diagnose-drives.sh
|
# 4 SATA ports used (ata-1, ata-2, ata-5, ata-6) - ata-3/4 empty
|
||||||
["storage-01"]="
|
["storage-01"]="
|
||||||
|
pci-0000:02:00.1-ata-1 1
|
||||||
|
pci-0000:02:00.1-ata-2 2
|
||||||
|
pci-0000:02:00.1-ata-5 3
|
||||||
|
pci-0000:02:00.1-ata-6 4
|
||||||
"
|
"
|
||||||
|
|
||||||
# large1
|
# large1
|
||||||
@@ -290,22 +294,21 @@ for bay in $(printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^[0-9]+$' | sort -n); d
|
|||||||
done
|
done
|
||||||
|
|
||||||
# NVMe drives
|
# NVMe drives
|
||||||
if command -v nvme >/dev/null 2>&1; then
|
nvme_devices=$(lsblk -d -n -o NAME,SIZE | grep "^nvme" 2>/dev/null)
|
||||||
nvme_output=$(sudo nvme list 2>/dev/null)
|
if [ -n "$nvme_devices" ]; then
|
||||||
if echo "$nvme_output" | grep -q "^/dev"; then
|
|
||||||
echo -e "\n=== NVMe Drives ==="
|
echo -e "\n=== NVMe Drives ==="
|
||||||
printf "%-15s %-10s %-10s %-40s %-25s\n" "DEVICE" "SIZE" "TYPE" "MODEL" "SERIAL"
|
printf "%-15s %-10s %-10s %-40s %-25s\n" "DEVICE" "SIZE" "TYPE" "MODEL" "SERIAL"
|
||||||
echo "------------------------------------------------------------------------------------------------------"
|
echo "------------------------------------------------------------------------------------------------------"
|
||||||
# Parse nvme list output - format varies by version, use column positions
|
echo "$nvme_devices" | while read -r name size; do
|
||||||
echo "$nvme_output" | grep "^/dev" | while read -r line; do
|
device="/dev/$name"
|
||||||
device=$(echo "$line" | awk '{print $1}')
|
# Get model and serial from smartctl for accuracy
|
||||||
serial=$(echo "$line" | awk '{print $2}')
|
smart_info=$(sudo smartctl -i "$device" 2>/dev/null)
|
||||||
model=$(echo "$line" | awk '{print $3}')
|
model=$(echo "$smart_info" | grep "Model Number" | cut -d: -f2 | xargs)
|
||||||
# Get size from lsblk for consistency
|
serial=$(echo "$smart_info" | grep "Serial Number" | cut -d: -f2 | xargs)
|
||||||
size=$(lsblk -d -n -o SIZE "$device" 2>/dev/null | xargs)
|
[[ -z "$model" ]] && model="-"
|
||||||
|
[[ -z "$serial" ]] && serial="-"
|
||||||
printf "%-15s %-10s %-10s %-40s %-25s\n" "$device" "$size" "NVMe" "$model" "$serial"
|
printf "%-15s %-10s %-10s %-40s %-25s\n" "$device" "$size" "NVMe" "$model" "$serial"
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user