summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core')
-rwxr-xr-xrecipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
index 9402286..a1c7244 100755
--- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
+++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh
@@ -272,7 +272,18 @@ mount_and_boot() {
log "user_data: $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT"
# Mount read-write file system into initram root file system
if ! $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT ; then
- fatal "Could not mount read-write rootfs"
+ if [ -n "${ROOT_RWDEVICE}" ]; then
+ # fsck didn't help. Reformat the partition
+ log "Could not mount read-write rootfs. Erasing ${ROOT_RWDEVICE} partition."
+ mkfs.ext4 -L user_data -O 64bit ${ROOT_RWDEVICE}
+ log "mounting user_data: $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT"
+ if ! $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT ; then
+ fatal "Could not mount read-write rootfs."
+ fi
+ log "${ROOT_RWDEVICE} partition has been erased and mounted successfully."
+ else
+ fatal "Could not mount read-write rootfs."
+ fi
fi
# Reset read-write file system if specified