Run fsck on filesystems in the guest's fstab.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Fri, 12 Oct 2007 00:03:23 +0000 (00:03 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Fri, 12 Oct 2007 00:03:23 +0000 (00:03 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2617 94cd875c-1c1d-0410-91d2-eb244daf1a30

scripts/vserver.functions
scripts/vserver.start

index 0918cc0..776e487 100644 (file)
@@ -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 <vserver> <context> <vshelper-fifo-varname>
 function initSync
 {
index a9b95c2..1656df0 100644 (file)
@@ -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"