fix any noncritical problems automatically
authorMatthias Förste <foerste@schlittermann.de>
Tue, 08 May 2012 11:36:14 +0200
changeset 9 a2875a6fd7b2
parent 8 b917ead1b6ef
child 10 577954f4f887
fix any noncritical problems automatically
snapfsck.sh
--- a/snapfsck.sh	Fri May 04 15:37:10 2012 +0200
+++ b/snapfsck.sh	Tue May 08 11:36:14 2012 +0200
@@ -39,7 +39,7 @@
     # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549691#74
     # https://bugzilla.redhat.com/show_bug.cgi?id=577798#c5
     # https://www.redhat.com/archives/linux-lvm/2010-August/msg00029.html
-    lvs "$vg/$lvs" >/dev/null 2>&1 && lvremove -f "$vg/$lvs"
+    lvs "$vg/$lvs" && lvremove -f "$vg/$lvs"
 
 }
 
@@ -67,7 +67,11 @@
 
 d=$(date +%Y%m%d%H%M%S)
 lvcreate -n"$lvs" -L"$SNAPSIZE" -s "$vg/$lv"
-if e2fsck -fp "/dev/$vg/$lvs"; then
+# fix any noncritical problems automatically and don't make any noise (on
+# stderr) about it; note that these problems remain present on the origin
+# volume
+e2fsck -fp "/dev/$vg/$lvs" 2>&1 || true
+if e2fsck -fy "/dev/$vg/$lvs" 2>&1; then
     tune2fs -C 1 -T "$d" "/dev/$vg/$lv"
 else
     die fsck returned nonzero: this may indicate filesystem corruption on the origin volume.