Should run fsck before mounting casper-rw

Bug #996668 reported by Ben Greear
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
casper (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

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

Revision history for this message
Ben Greear (greearb) wrote :

I have a better fix for this, posted here:

https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/125702

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in casper (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.