Skip to content

Commit

Permalink
boot/init: auto-resize task shows a message
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldr committed Nov 6, 2020
1 parent bd030cb commit d929d79
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions boot/init/tasks/auto_resize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ def initialize(device, type: )
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)
Progress.with_message("Verifying #{@device}...") do
# 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
end
Progress.with_message("Resizing #{@device}...") do
System.run("resize2fs", "-f", @device)
end
System.run("resize2fs", "-f", @device)
else
$logger.warn("Cannot resize #{@type}... filesystem left untouched.")
end
Expand Down

0 comments on commit d929d79

Please sign in to comment.