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
|
||||
# Different motherboard, no HBA currently
|
||||
# TODO: Map actual PCI paths after running diagnose-drives.sh
|
||||
# Motherboard: ASRock A320M-HDV R4.0 with AMD SATA controller at 02:00.1
|
||||
# 4 SATA ports used (ata-1, ata-2, ata-5, ata-6) - ata-3/4 empty
|
||||
["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
|
||||
@@ -290,22 +294,21 @@ for bay in $(printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^[0-9]+$' | sort -n); d
|
||||
done
|
||||
|
||||
# NVMe drives
|
||||
if command -v nvme >/dev/null 2>&1; then
|
||||
nvme_output=$(sudo nvme list 2>/dev/null)
|
||||
if echo "$nvme_output" | grep -q "^/dev"; then
|
||||
echo -e "\n=== NVMe Drives ==="
|
||||
printf "%-15s %-10s %-10s %-40s %-25s\n" "DEVICE" "SIZE" "TYPE" "MODEL" "SERIAL"
|
||||
echo "------------------------------------------------------------------------------------------------------"
|
||||
# Parse nvme list output - format varies by version, use column positions
|
||||
echo "$nvme_output" | grep "^/dev" | while read -r line; do
|
||||
device=$(echo "$line" | awk '{print $1}')
|
||||
serial=$(echo "$line" | awk '{print $2}')
|
||||
model=$(echo "$line" | awk '{print $3}')
|
||||
# Get size from lsblk for consistency
|
||||
size=$(lsblk -d -n -o SIZE "$device" 2>/dev/null | xargs)
|
||||
printf "%-15s %-10s %-10s %-40s %-25s\n" "$device" "$size" "NVMe" "$model" "$serial"
|
||||
done
|
||||
fi
|
||||
nvme_devices=$(lsblk -d -n -o NAME,SIZE | grep "^nvme" 2>/dev/null)
|
||||
if [ -n "$nvme_devices" ]; then
|
||||
echo -e "\n=== NVMe Drives ==="
|
||||
printf "%-15s %-10s %-10s %-40s %-25s\n" "DEVICE" "SIZE" "TYPE" "MODEL" "SERIAL"
|
||||
echo "------------------------------------------------------------------------------------------------------"
|
||||
echo "$nvme_devices" | while read -r name size; do
|
||||
device="/dev/$name"
|
||||
# Get model and serial from smartctl for accuracy
|
||||
smart_info=$(sudo smartctl -i "$device" 2>/dev/null)
|
||||
model=$(echo "$smart_info" | grep "Model Number" | cut -d: -f2 | xargs)
|
||||
serial=$(echo "$smart_info" | grep "Serial Number" | cut -d: -f2 | xargs)
|
||||
[[ -z "$model" ]] && model="-"
|
||||
[[ -z "$serial" ]] && serial="-"
|
||||
printf "%-15s %-10s %-10s %-40s %-25s\n" "$device" "$size" "NVMe" "$model" "$serial"
|
||||
done
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user