From 4ae16ff51c174441f2651130e78dad5d8db6c8f4 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Fri, 12 Oct 2007 00:03:23 +0000 Subject: [PATCH] Run fsck on filesystems in the guest's fstab. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2617 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- scripts/vserver.functions | 16 ++++++++++++++++ scripts/vserver.start | 2 ++ 2 files changed, 18 insertions(+) diff --git a/scripts/vserver.functions b/scripts/vserver.functions index 0918cc0..776e487 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -893,6 +893,22 @@ function umountVserver test -n "$is_ok" } +function fsckAllFS +{ + local cfgdir=$1 + local fstab="$cfgdir"/fstab + local FSTAB_FILE + local fsck_exitcode + + test -e "$fstab" || return 0 + + export FSTAB_FILE="$fstab" + $_FSCK -s -n -A -T + fsck_exitcode=$? + test "$fsck_exitcode" -eq 0 -o \ + "$fsck_exitcode" -eq 1 || return $fsck_exitcode +} + ## Usage: waitForSync function initSync { diff --git a/scripts/vserver.start b/scripts/vserver.start index a9b95c2..1656df0 100644 --- a/scripts/vserver.start +++ b/scripts/vserver.start @@ -105,6 +105,8 @@ pushd "$VSERVER_DIR" >/dev/null execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" initialize popd >/dev/null +fsckAllFS "$VSERVER_DIR" + mountRootFS "$VSERVER_DIR" generateOptions "$VSERVER_DIR" -- 1.8.1.5