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:
@@ -500,14 +500,21 @@ for bay in $all_bays; do
|
||||
osd_id="-"
|
||||
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="-"
|
||||
if mount | grep -q "^/dev/${device}"; then
|
||||
mount_point=$(mount | grep "^/dev/${device}" | awk '{print $3}' | head -1)
|
||||
if [[ "$mount_point" == "/" ]]; then
|
||||
mount_points="$(lsblk -n -o MOUNTPOINT "/dev/$device" 2>/dev/null | grep -v '^$' | head -3 | tr '\n' ',')"
|
||||
mount_points="${mount_points%,}" # Remove trailing comma
|
||||
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"
|
||||
else
|
||||
usage="$mount_point"
|
||||
usage="$mount_points"
|
||||
fi
|
||||
else
|
||||
usage="$mount_points"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user