From 7579f371d7b854564d6ffc227c2694d5f5a9b394 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 5 Feb 2026 20:10:46 -0500 Subject: [PATCH] Fix Ceph device parsing to use devices line The "block device" line in ceph-volume output shows LVM paths like ceph-xxx/osd-block-xxx, not physical device names. Changed to parse the "devices" line which contains the actual physical device path like /dev/sda. Also reset current_osd after match to avoid duplicate matches. Fixes: https://code.lotusguild.org/LotusGuild/driveAtlas/issues/17 Co-Authored-By: Claude Opus 4.5 --- driveAtlas.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/driveAtlas.sh b/driveAtlas.sh index bfc879e..a1855f2 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -670,12 +670,14 @@ build_ceph_cache() { # Match OSD header: "====== osd.5 =======" if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+======= ]]; then current_osd="osd.${BASH_REMATCH[1]}" - # Match block device line: " block device /dev/sda" - elif [[ -n "$current_osd" && "$line" =~ block[[:space:]]device[[:space:]]+/dev/([^[:space:]]+) ]]; then + # Match "devices" line which has the actual physical device: " devices /dev/sda" + # This is more reliable than "block device" which may show LVM paths + elif [[ -n "$current_osd" && "$line" =~ devices[[:space:]]+/dev/(sd[a-z]+|nvme[0-9]+n[0-9]+) ]]; then local dev_name="${BASH_REMATCH[1]}" CEPH_DEVICE_TO_OSD["$dev_name"]="$current_osd" ((osd_count++)) log_info "Found $current_osd on $dev_name" + current_osd="" # Reset to avoid duplicate matches fi done < <(ceph-volume lvm list 2>/dev/null) log_info "Cached $osd_count Ceph OSDs"