Fix ASCII art rendering and correct bay 1 mapping

Fixed issues:
- ASCII art boxes now render correctly with fixed-width layout
- Corrected bay 1 mapping: ata-2 -> bay 1 (sdh SSD confirmed)
- Adjusted mobo SATA port mappings based on physical verification
- Simplified layout to use consistent 10-character wide bay boxes

Bay 1 is confirmed to contain sdh (Crucial SSD boot drive) which maps
to pci-0000:0d:00.0-ata-2, so the mapping has been corrected.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-06 16:13:17 -05:00
parent 1b35db6723
commit be541cba97
2 changed files with 37 additions and 44 deletions

View File

@@ -14,63 +14,45 @@ generate_10bay_layout() {
local hostname=$1 local hostname=$1
build_drive_map build_drive_map
# Calculate max width needed for drive names # Fixed width for consistent box drawing (fits device names like "nvme0n1")
max_width=0 local drive_width=10
for bay in {1..10} "m2-1" "usb1" "usb2"; do
drive_text="${DRIVE_MAP[$bay]:-EMPTY}"
text_len=$((${#bay} + 1 + ${#drive_text}))
[[ $text_len -gt $max_width ]] && max_width=$text_len
done
# Add padding for box borders
box_width=$((max_width + 4))
# Create box drawing elements
h_line=$(printf '%*s' "$box_width" '' | tr ' ' '─')
# USB Section (if applicable)
if [[ -n "${DRIVE_MAP[usb1]}" || -n "${DRIVE_MAP[usb2]}" ]]; then
printf "\n External USB\n"
printf " ┌%s┐ ┌%s┐\n" "$h_line" "$h_line"
printf " │ %-${max_width}s │ │ %-${max_width}s │\n" "${DRIVE_MAP[usb1]:-EMPTY}" "${DRIVE_MAP[usb2]:-EMPTY}"
printf " └%s┘ └%s┘\n\n" "$h_line" "$h_line"
fi
# Main chassis section # Main chassis section
printf "┌──────────────────────────────────────────────────────────────┐\n" printf "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐\n"
printf "│ %-58s │\n" "$hostname" printf "│ %-126s │\n" "$hostname - 10-Bay Hot-swap Chassis"
printf "│ %-58s │\n" "10-Bay Hot-swap Chassis"
printf "│ │\n" printf "│ │\n"
# M.2 NVMe slot if present # M.2 NVMe slot if present
if [[ -n "${DRIVE_MAP[m2-1]}" ]]; then if [[ -n "${DRIVE_MAP[m2-1]}" ]]; then
printf "│ M.2 NVMe Slot │\n" printf "│ M.2 NVMe: %-10s │\n" "${DRIVE_MAP[m2-1]}"
printf "│ ┌%s┐ │\n" "$h_line"
printf "│ │ %-${max_width}s │ │\n" "${DRIVE_MAP[m2-1]:-EMPTY}"
printf "│ └%s┘ │\n" "$h_line"
printf "│ │\n" printf "│ │\n"
fi fi
printf "│ Front Hot-swap Bays │\n" printf "│ Front Hot-swap Bays: │\n"
printf "│ │\n"
# Create bay rows # Bay top borders
printf "│ " printf "│ "
for bay in {1..10}; do for bay in {1..10}; do
printf "┌%s┐" "$h_line" printf "┌──────────┐ "
done done
printf " │\n" printf "│\n"
# Bay contents
printf "│ "
for bay in {1..10}; do for bay in {1..10}; do
printf "│%-2d:%-${max_width}s │" "$bay" "${DRIVE_MAP[$bay]:-EMPTY}" printf "│%-2d:%-7s│ " "$bay" "${DRIVE_MAP[$bay]:-EMPTY}"
done done
printf " │\n" printf "│\n"
# Bay bottom borders
printf "│ "
for bay in {1..10}; do for bay in {1..10}; do
printf "└%s┘" "$h_line" printf "└──────────┘ "
done done
printf " │\n" printf "│\n"
printf "└──────────────────────────────────────────────────────────────┘\n" printf "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n"
} }
generate_large1_layout() { generate_large1_layout() {
@@ -123,10 +105,10 @@ declare -A SERVER_MAPPINGS=(
# - HBA bottom mini-SAS: bays 5,6,7,8 # - HBA bottom mini-SAS: bays 5,6,7,8
# - HBA top mini-SAS: bays 9,10 # - HBA top mini-SAS: bays 9,10
["compute-storage-01"]=" ["compute-storage-01"]="
pci-0000:0d:00.0-ata-3 1 pci-0000:0d:00.0-ata-2 1
pci-0000:0d:00.0-ata-4 2 pci-0000:0d:00.0-ata-1 2
pci-0000:0d:00.0-ata-2 3 pci-0000:0d:00.0-ata-3 3
pci-0000:0d:00.0-ata-1 4 pci-0000:0d:00.0-ata-4 4
pci-0000:01:00.0-sas-phy2-lun-0 5 pci-0000:01:00.0-sas-phy2-lun-0 5
pci-0000:01:00.0-sas-phy3-lun-0 6 pci-0000:01:00.0-sas-phy3-lun-0 6
pci-0000:01:00.0-sas-phy4-lun-0 7 pci-0000:01:00.0-sas-phy4-lun-0 7

11
get-serials.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
echo "=== Drive Serial Numbers ==="
for dev in sd{a..j}; do
if [ -b "/dev/$dev" ]; then
serial=$(sudo smartctl -i /dev/$dev 2>/dev/null | grep "Serial Number" | awk '{print $3}')
model=$(sudo smartctl -i /dev/$dev 2>/dev/null | grep "Device Model\|Model Number" | cut -d: -f2 | xargs)
size=$(lsblk -d -n -o SIZE /dev/$dev 2>/dev/null)
echo "/dev/$dev: $serial ($size - $model)"
fi
done