From 743d4c0b3e7b7836bb5487a84f10a0df1e623c62 Mon Sep 17 00:00:00 2001 From: Rowan Wookey Date: Tue, 13 Oct 2020 11:55:26 +0100 Subject: [PATCH] Automatically fsck data paritition on boot By default this runs e2fsck on the data partition on boot before mounting. A forced fsck can be enabled by adding `fsck.mode=force` to /boot/cmdline.txt Moved from https://github.com/ccrisan/motioneyeos/pull/2464 --- board/common/overlay/etc/init.d/S00datapart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/board/common/overlay/etc/init.d/S00datapart b/board/common/overlay/etc/init.d/S00datapart index 4bdc300bc0..35b073d5a4 100755 --- a/board/common/overlay/etc/init.d/S00datapart +++ b/board/common/overlay/etc/init.d/S00datapart @@ -41,7 +41,16 @@ case "$1" in 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} + else + /sbin/e2fsck -y ${data_dev} + fi + exit 0 + fi msg_begin "Creating data partition" data_start=$((DATA_OFFS * 2048))