Automatically fsck motioneyeos data partition on boot
One of my motioneyeos cameras was stuck in a boot loop due to a corrupt /data partition.
The usual kernel fsck parameters didn't work so I modified /etc/init.d/S00datapart
using
the following patch to check the /data partition on boot if fsck.mode=force
is in /boot/cmdline.txt
--- a/S00datapart
+++ b/S00datapart
@@ -23,7 +23,14 @@ case "$1" in
fi
msg_done "${disk_dev}"
- test -b ${data_dev} && exit 0
+ if [ -b ${data_dev} ]
+ then
+ if grep -q 'fsck.mode=force' /proc/cmdline
+ then
+ /sbin/e2fsck -fy ${data_dev}
+ fi
+ exit 0
+ fi
msg_begin "Creating data partition"
data_start=$((DATA_OFFS * 2048))