stage-1: workaround issue with e2fsck successfully failing
@@ -11,7 +11,18 @@ class Tasks::AutoResize < Task
def run()
log("Resizing #{@device}...")
if @type.match(/^ext[234]$/)
+ # TODO: Understand the actual underlying issue with e2fsck.
+ # It seems `e2fsck` succeeds, according to the output, but has a >0 exit
+ # status. Running it again in those situations is a no-op, which is weird
+ # to me.
+ # This is why we unconditionally run it once, then twice.
+ # The second will hopefully abort the boot if it fails too.
+ begin
System.run("e2fsck", "-fp", @device)
+ rescue System::CommandError
+ $logger.info("Re-running e2fsc...")
+ System.run("e2fsck", "-fp", @device)
+ end
System.run("resize2fs", "-f", @device)
else
$logger.warn("Cannot resize #{@type}... filesystem left untouched.")
