Fix mount point detection to include partitions

Use lsblk instead of mount command to detect mount points. This
properly detects mounts on partitions (e.g., /dev/sda1) rather
than only whole-device mounts.

- Shows multiple mount points (up to 3) comma-separated
- Correctly identifies BOOT drives with root partition
- Handles NVMe partition naming (nvme0n1p1, etc.)

Fixes: #8

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 11:27:43 -05:00
parent 3e74a5a047
commit 6b4a985b95

View File

@@ -500,14 +500,21 @@ for bay in $all_bays; do
osd_id="-" osd_id="-"
fi fi
# Check if boot drive # Check mount points using lsblk (includes partitions)
# This catches both whole-device mounts and partition mounts (e.g., /dev/sda1)
usage="-" usage="-"
if mount | grep -q "^/dev/${device}"; then mount_points="$(lsblk -n -o MOUNTPOINT "/dev/$device" 2>/dev/null | grep -v '^$' | head -3 | tr '\n' ',')"
mount_point=$(mount | grep "^/dev/${device}" | awk '{print $3}' | head -1) mount_points="${mount_points%,}" # Remove trailing comma
if [[ "$mount_point" == "/" ]]; then if [[ -n "$mount_points" ]]; then
if [[ "$mount_points" == *"/"* && ! "$mount_points" == *"/boot"* && ! "$mount_points" == *"/home"* ]]; then
# Root filesystem mounted (but not just /boot or /home)
if echo "$mount_points" | grep -qE '^/,|^/$|,/$'; then
usage="BOOT" usage="BOOT"
else else
usage="$mount_point" usage="$mount_points"
fi
else
usage="$mount_points"
fi fi
fi fi