From ca7027f08934d061c3de4402505a2e25d37df6ce Mon Sep 17 00:00:00 2001 From: Mike Hibler Date: Mon, 3 Jul 2017 15:02:42 -0600 Subject: [PATCH] For a Linux image, run a post-frisbee "preen" fsck. Try to catch the occasional corrupt filesystem before we make it worse. --- clientside/tmcc/freebsd/slicefix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/clientside/tmcc/freebsd/slicefix b/clientside/tmcc/freebsd/slicefix index c16d572d1..c0bd7bcf4 100755 --- a/clientside/tmcc/freebsd/slicefix +++ b/clientside/tmcc/freebsd/slicefix @@ -661,6 +661,7 @@ dofreebsd() { cmp -s /etc/ssh/ssh_host_${k}key /mnt/etc/ssh/ssh_host_${k}key if [ $? -ne 0 ]; then changehostkeys=1 + fixit=1 fi fi done @@ -1088,6 +1089,18 @@ dolinux() { rootdev=/dev/${disk}s${part} fi + # + # XXX Ugh, we seem to be facing any number of FS issues. Now we + # are seeing cases where the image is not captured cleanly. + # In an attempt to compensate for this, we do a precautionary + # fsck here out of an abundance of caution. + # + echo " running precautionary fsck on $rootdev" + e2fsck -p $rootdev >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "WARNING: loaded image had filesystem problems (exit $?)." + fi + needfsck=0 # @@ -1102,6 +1115,7 @@ dolinux() { if [ -x /usr/local/sbin/dumpe2fs -a "x$vers" = "x9" ]; then GOTDI=`dumpe2fs -h $rootdev 2>/dev/null | grep '^Filesystem features:.*dir_index'` if [ -n "$GOTDI" ]; then + echo " temporarily disabling EXT dir_index" tune2fs -O '^dir_index' $rootdev needfsck=1 fi @@ -1611,8 +1625,9 @@ EOF7 # if [ $needfsck -ne 0 ]; then if [ -n "$GOTDI" ]; then + echo " reeabling EXT dir_index" tune2fs -O dir_index $rootdev || { - echo "WARNING: could not reenable dir_index" + echo "WARNING: could not reenable EXT dir_index" needfsck=0 } elif [ ! -e /mnt/etc/selinux/config ]; then -- GitLab