From 1f6ac83881328c7103994c53e81f1564d7a93736 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Mon, 24 Aug 2020 15:20:04 -0500 Subject: mmc-init: Run fsck.ext4 on the rwfs device It's a good practice to run fsck before mounting a device. Call fsck.ext4 -p on the read-write device, this option attempts to fix any error that can be fixed safely without user intervention. No need to check for the return code, if it fails then the mount command will likely fail. It also takes no time to run: mount read-only -> fsck read-write -> mount read-write: [ 4.174115] EXT4-fs (mmcblk0p4): mounted filesystem with ordered data mode. Opts: (null) rwfs: clean, 11/917504 files, 81919/1835008 blocks [ 4.185143] EXT4-fs (mmcblk0p6): mounted filesystem with ordered data mode. Opts: (null) (From meta-phosphor rev: c3d695892ef990f70cb851b5613dee68068471b3) Change-Id: I946791233a06da0c8ee16585d92f64039a845879 Signed-off-by: Adriana Kobylak Signed-off-by: Andrew Geissler --- .../recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'meta-phosphor') diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh index d41ddf713..061757519 100644 --- a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh +++ b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh @@ -48,7 +48,10 @@ mkdir -p $rodir if ! mount /dev/disk/by-partlabel/"$(get_root)" $rodir -t ext4 -o ro; then /bin/sh fi -if ! mount /dev/disk/by-partlabel/rwfs $rodir/var -t ext4 -o rw; then + +rwfsdev="/dev/disk/by-partlabel/rwfs" +fsck.ext4 -p "${rwfsdev}" +if ! mount "${rwfsdev}" $rodir/var -t ext4 -o rw; then /bin/sh fi -- cgit v1.2.3