Easiest and cleanest would be to pass the -q quiet parameter, but
that drops also possible relevant information when rescuing such a
filesystem (super block backup positions, UUID, ...)
Will let thorugh something like:
> Creating filesystem with 262144 4k blocks and 65536 inodes
> Filesystem UUID:
3a6f3548-baf6-45fa-93d2-
b61212668d23
> Superblock backups stored on blocks:
> 32768, 98304, 163840, 229376
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
sub mkfs {
my ($dev, $rootuid, $rootgid) = @_;
- run_command(['mkfs.ext4', '-O', 'mmp',
- '-E', "root_owner=$rootuid:$rootgid",
- $dev]);
+ run_command(
+ [
+ 'mkfs.ext4',
+ '-O',
+ 'mmp',
+ '-E',
+ "root_owner=$rootuid:$rootgid",
+ $dev,
+ ],
+ outfunc => sub {
+ my $line = shift;
+ # a hack to print only the relevant stuff, i.e., the one which could help on repair
+ if ($line =~ /^(Creating filesystem|Filesystem UUID|Superblock backups|\s+\d+, \d)/) {
+ print "$line\n";
+ }
+ },
+ errfunc => sub {
+ my $line = shift;
+ print STDERR "$line\n" if $line && $line !~ /^mke2fs \d\.\d/;
+ }
+ );
}
sub format_disk {