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"