From: INSUN PYO Date: Wed, 13 Mar 2019 09:02:42 +0000 (+0900) Subject: Fix resizefs: corrupted filesystem can not perform resizefs X-Git-Tag: accepted/tizen/unified/20191112.125225^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F77%2F201377%2F1;p=platform%2Fcore%2Fsystem%2Finitrd.git Fix resizefs: corrupted filesystem can not perform resizefs //////////// Steps to reproduce the problem /////////////////////// 1. Flush all binary 2. Flush only user.img binary (tar cvfz user.tar.gz user.img) 3. remove /opt/var/.resizefs_done 4. remove and insert battery, and turn on device 5. user partition fails to execute resizefs. /////////////////////////////////////////////////////////////////// //////////// UART Log on TM1 ////////////////////////////////////// resize2fs 1.43.4 (31-Jan-2017) Resizing the filesystem on /dev/mmcblk0p25 to 1481216 (4k) blocks. The filesystem on /dev/mmcblk0p25 is now 1481216 (4k) blocks long. fsck from util-linux 2.30 e2fsck 1.43.4 (31-Jan-2017) user: recovering journal Setting free inodes count to 7301 (was 7434) Setting free blocks count to 8022 (was 8489) user: clean, 699/8000 files, 10286/18308 blocks //////////////////////////////////////////////////////////////////// ///// df - user partition is 18308 blocks, not 1481216 ///////////// /dev/mmcblk0p25 38448 6008 30976 17% /opt/usr //////////////////////////////////////////////////////////////////// Change-Id: I8ee7161b504a56fb859af2472ef3295601f02ce6 --- diff --git a/scripts/init.sh b/scripts/init.sh index 7b884de..60235e2 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -55,6 +55,7 @@ if [ x$ROOTFS != "x" ] then if [ "$NEED_RESIZEFS" = "1" ] then + /sbin/fsck -y $ROOTFS /sbin/resize2fs -f $ROOTFS fi /sbin/fsck -y $ROOTFS @@ -68,6 +69,7 @@ if [ x"$DATAFS" != "x" ] then if [ "$NEED_RESIZEFS" = "1" ] then + /sbin/fsck -y $DATAFS /sbin/resize2fs -f $DATAFS /sbin/fsck -y $DATAFS /bin/mount $DATAFS /sysroot/opt @@ -80,6 +82,7 @@ if [ x"$USERFS" != "x" -a "$USERFS_ENCRYPTED" = "0" ] then if [ "$NEED_RESIZEFS" = "1" ] then + /sbin/fsck -y $USERFS /sbin/resize2fs -f $USERFS fi /sbin/fsck -y $USERFS @@ -99,6 +102,7 @@ if [ x$MODULES != "x" ] then if [ "$NEED_RESIZEFS" = "1" ] then + /sbin/fsck -y $MODULES /sbin/resize2fs -f $MODULES fi /sbin/fsck -y $MODULES