diff --git a/btrbk b/btrbk index 4e6fbb2..ee5bc99 100755 --- a/btrbk +++ b/btrbk @@ -142,7 +142,7 @@ sub HELP_MESSAGE print STDERR " run [subvol...] perform backup operations as defined in the config file\n"; print STDERR " dryrun [subvol...] don't run btrfs commands; show what would be executed\n"; print STDERR " tree [subvol...] shows backup tree\n"; - print STDERR " info print useful filesystem information\n"; + print STDERR " info [subvol...] print useful filesystem information\n"; print STDERR " origin print origin information for subvolume\n"; print STDERR " diff shows new files since subvolume for subvolume \n"; print STDERR "\n"; @@ -1330,9 +1330,9 @@ sub print_header(@) { } if($config) { print " Config: $config->{SRC_FILE}\n"; - if($config->{CMDLINE_FILTER}) { + if($config->{CMDLINE_FILTER_LIST}) { print " Filter: "; - print join("\n ", map { $_->{PRINT} } @{$config->{CMDLINE_FILTER}}); + print join("\n ", map { $_->{PRINT} } @{$config->{CMDLINE_FILTER_LIST}}); print "\n"; } } @@ -1402,6 +1402,9 @@ MAIN: } elsif ($command eq "info") { $action_info = 1; + $args_expected_min = 0; + $args_expected_max = 9999; + @subvol_args = @ARGV; } elsif ($command eq "tree") { $action_tree = 1; @@ -1562,60 +1565,10 @@ MAIN: } - - if($action_info) - { - # - # print filesystem information - # - print "================================================================================\n"; - print "Filesystem information ($version_info)\n\n"; - print " Date: " . localtime($start_time) . "\n"; - print " Config: $config->{SRC_FILE}\n"; - print "================================================================================\n"; - - my %processed; - foreach my $config_vol (@{$config->{VOLUME}}) - { - my $sroot = vinfo($config_vol->{url}, $config_vol); - unless($processed{$sroot->{URL}}) - { - print "\n--------------------------------------------------------------------------------\n"; - print "Source volume: $sroot->{PRINT}\n"; - print "--------------------------------------------------------------------------------\n"; - print (btrfs_filesystem_usage($sroot) // ""); - print "\n"; - $processed{$sroot->{URL}} = 1; - } - } - - foreach my $config_vol (@{$config->{VOLUME}}) { - my $sroot = vinfo($config_vol->{url}, $config_vol); - foreach my $config_subvol (@{$config_vol->{SUBVOLUME}}) { - foreach my $config_target (@{$config_subvol->{TARGET}}) - { - my $droot = vinfo($config_target->{url}, $config_target); - unless($processed{$droot->{URL}}) - { - print "\n--------------------------------------------------------------------------------\n"; - print "Target volume: $droot->{PRINT}\n"; - print " ^--- $sroot->{PRINT}\n"; - print "--------------------------------------------------------------------------------\n"; - print (btrfs_filesystem_usage($droot) // ""); - print "\n"; - $processed{$droot->{URL}} = 1; - } - } - } - } - exit 0; - } - - # # filter subvolumes matching command line arguments # - if(($action_run || $action_tree) && scalar(@subvol_args)) + if(($action_run || $action_tree || $action_info) && scalar(@subvol_args)) { my $filter_count = undef; my @filter; @@ -1652,7 +1605,59 @@ MAIN: } exit 1; } - $config->{CMDLINE_FILTER} = \@filter; + $config->{CMDLINE_FILTER_LIST} = \@filter; + } + + + if($action_info) + { + # + # print filesystem information + # + print "================================================================================\n"; + print "Filesystem information ($version_info)\n\n"; + print " Date: " . localtime($start_time) . "\n"; + print " Config: $config->{SRC_FILE}\n"; + print "================================================================================\n"; + + my %processed; + foreach my $config_vol (@{$config->{VOLUME}}) + { + next if($config_vol->{ABORTED}); + my $sroot = vinfo($config_vol->{url}, $config_vol); + unless($processed{$sroot->{URL}}) + { + print "\n--------------------------------------------------------------------------------\n"; + print "Source volume: $sroot->{PRINT}\n"; + print "--------------------------------------------------------------------------------\n"; + print (btrfs_filesystem_usage($sroot) // ""); + print "\n"; + $processed{$sroot->{URL}} = 1; + } + } + + foreach my $config_vol (@{$config->{VOLUME}}) { + next if($config_vol->{ABORTED}); + my $sroot = vinfo($config_vol->{url}, $config_vol); + foreach my $config_subvol (@{$config_vol->{SUBVOLUME}}) { + next if($config_subvol->{ABORTED}); + foreach my $config_target (@{$config_subvol->{TARGET}}) + { + my $droot = vinfo($config_target->{url}, $config_target); + unless($processed{$droot->{URL}}) + { + print "\n--------------------------------------------------------------------------------\n"; + print "Target volume: $droot->{PRINT}\n"; + print " ^--- $sroot->{PRINT}\n"; + print "--------------------------------------------------------------------------------\n"; + print (btrfs_filesystem_usage($droot) // ""); + print "\n"; + $processed{$droot->{URL}} = 1; + } + } + } + } + exit 0; } diff --git a/doc/btrbk.1 b/doc/btrbk.1 index c0150f0..f2f3f5a 100644 --- a/doc/btrbk.1 +++ b/doc/btrbk.1 @@ -1,4 +1,4 @@ -.TH "btrbk" "1" "2015-05-26" "btrbk v0.18.0" "" +.TH "btrbk" "1" "2015-05-27" "btrbk v0.18.0" "" .SH NAME btrbk \- backup tool for btrfs volumes .SH SYNOPSIS @@ -85,15 +85,17 @@ would be executed. .RE .PP .B info +[subvolume...] .RS 4 -Print filesystem usage information for all source/target volumes. +Print filesystem usage information for all source/target +volumes. Optionally filtered by [subvolume...] arguments. .RE .PP .B tree [subvolume...] .RS 4 Print the snapshots and their corresponding backup subvolumes as a -tree. +tree. Optionally filtered by [subvolume...] arguments. .RE .PP .B origin