diff --git a/driveAtlas.sh b/driveAtlas.sh index 66d2563..713dc7b 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -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 - usage="BOOT" + 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_points" + fi else - usage="$mount_point" + usage="$mount_points" fi fi