Fix SD flash mounting wrong partition — Armbian p1=boot p2=rootfs
WiFi, SSH keys, root password, firstboot service were all being written to the FAT32 boot partition (p1) instead of the ext4 rootfs (p2). Detect the ext4 partition by filesystem type and mount that as MOUNT_POINT.
This commit is contained in:
+17
-4
@@ -453,12 +453,25 @@ step "Running partprobe..."
|
||||
partprobe "/dev/${DEVICE}" || warn "partprobe failed (non-critical)"
|
||||
sleep 3
|
||||
|
||||
step "Mounting to ${MOUNT_POINT}..."
|
||||
step "Mounting rootfs to ${MOUNT_POINT}..."
|
||||
mkdir -p "$MOUNT_POINT"
|
||||
# Try /dev/${DEVICE}1 (most common for single-partition images)
|
||||
mount "/dev/${DEVICE}1" "$MOUNT_POINT" 2>/dev/null || mount "/dev/${DEVICE}p1" "$MOUNT_POINT" || error "Mount failed. Check device partitioning."
|
||||
# Armbian images: p1=FAT32 boot, p2=ext4 rootfs. Mount the rootfs partition.
|
||||
# Detect by filesystem type; fall back to p1 for single-partition images.
|
||||
_ROOTFS_PART=""
|
||||
for _try in "/dev/${DEVICE}2" "/dev/${DEVICE}p2"; do
|
||||
if [[ -b "$_try" ]] && blkid "$_try" 2>/dev/null | grep -qi ext; then
|
||||
_ROOTFS_PART="$_try"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -n "$_ROOTFS_PART" ]]; then
|
||||
mount "$_ROOTFS_PART" "$MOUNT_POINT" || error "Mount of rootfs (${_ROOTFS_PART}) failed"
|
||||
else
|
||||
# Single-partition image fallback
|
||||
mount "/dev/${DEVICE}1" "$MOUNT_POINT" 2>/dev/null || mount "/dev/${DEVICE}p1" "$MOUNT_POINT" || error "Mount failed — could not locate ext4 rootfs partition"
|
||||
fi
|
||||
|
||||
info "Mounted at ${MOUNT_POINT}"
|
||||
info "Mounted at ${MOUNT_POINT} ($(blkid -o value -s TYPE "${_ROOTFS_PART:-/dev/${DEVICE}1}"))"
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════════════════
|
||||
# 7. APPLY CONFIGURATION TO CARD
|
||||
|
||||
Reference in New Issue
Block a user