Public bug reported:

If you crash your pendrive system, casper-rw can be corrupted.
casper should check using fsck before mounting casper-rw to
catch this and allow users to fix the problem if it cannot be fixed
automatically.

Here's a patch that I think will do the trick for the ext2/3/4 file-systems
at least.  I coppied e2fsck.static to the ramdisk and put it in sbin.

greearb@v-ubuntu-12-04:/tmp/ramdisk/scripts$ diff -u ~/casper.orig casper
--- /home/greearb/casper.orig   2012-05-08 09:09:43.012658969 -0700
+++ casper      2012-05-08 10:43:20.016662223 -0700
@@ -441,6 +441,14 @@
         fi
     fi
 
+    if [ "_${cow_fstype}" = "_ext2" -o "_${cow_fstype}" = "_ext3" -o 
"_${cow_fstype}" = "_ext4" ]
+       then
+       [ "$quiet" != "y" ] && log_warning_msg "Running e2fsck on ${cowdevice}, 
fstype: ${cow_fstype}"
+       e2fsck -p ${cowdevice} || panic "ERROR: File system corruption on 
${cowdevice}.  Run: e2fsck ${cowdevice}"
+    else
+       [ "$quiet" != "y" ] && log_warning_msg "Not running fsck on 
${cowdevice}, only ext2/2/4 fsck supported: ${cow_fstype}"
+    fi
+
     mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || panic "Can 
not mount $cowdevice on /cow"
 
     case ${UNIONFS} in

** Affects: casper (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/996668

Title:
  Should run fsck before mounting casper-rw

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/996668/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to