mirror of https://github.com/digint/btrbk
btrbk: added more information on backup summary; added documentation
parent
f02caad81f
commit
6a00736a2b
35
btrbk
35
btrbk
|
@ -279,13 +279,6 @@ sub check_file($$$$)
|
||||||
sub parse_config(@)
|
sub parse_config(@)
|
||||||
{
|
{
|
||||||
my @config_files = @_;
|
my @config_files = @_;
|
||||||
my $root = { CONTEXT => "root" };
|
|
||||||
my $cur = $root;
|
|
||||||
# set defaults
|
|
||||||
foreach (keys %config_options) {
|
|
||||||
$root->{$_} = $config_options{$_}->{default};
|
|
||||||
}
|
|
||||||
|
|
||||||
my $file = undef;
|
my $file = undef;
|
||||||
foreach(@config_files) {
|
foreach(@config_files) {
|
||||||
TRACE "config: checking for file: $_";
|
TRACE "config: checking for file: $_";
|
||||||
|
@ -299,6 +292,13 @@ sub parse_config(@)
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $root = { CONTEXT => "root", SRC_FILE => $file };
|
||||||
|
my $cur = $root;
|
||||||
|
# set defaults
|
||||||
|
foreach (keys %config_options) {
|
||||||
|
$root->{$_} = $config_options{$_}->{default};
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG "config: parsing file: $file";
|
DEBUG "config: parsing file: $file";
|
||||||
open(FILE, '<', $file) or die $!;
|
open(FILE, '<', $file) or die $!;
|
||||||
while (<FILE>) {
|
while (<FILE>) {
|
||||||
|
@ -866,6 +866,7 @@ MAIN:
|
||||||
$ENV{PATH} = '';
|
$ENV{PATH} = '';
|
||||||
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
||||||
$Data::Dumper::Sortkeys = 1;
|
$Data::Dumper::Sortkeys = 1;
|
||||||
|
my $start_time = time;
|
||||||
my @today = Today();
|
my @today = Today();
|
||||||
|
|
||||||
my %opts;
|
my %opts;
|
||||||
|
@ -1323,6 +1324,8 @@ MAIN:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $time_elapsed = time - $start_time;
|
||||||
|
INFO "Completed within: ${time_elapsed}s";
|
||||||
|
|
||||||
#
|
#
|
||||||
# print summary
|
# print summary
|
||||||
|
@ -1331,7 +1334,9 @@ MAIN:
|
||||||
{
|
{
|
||||||
my $err_count = 0;
|
my $err_count = 0;
|
||||||
print "--------------------------------------------------------------------------------\n";
|
print "--------------------------------------------------------------------------------\n";
|
||||||
print "Backup Summary ($version_info)\n";
|
print "Backup Summary ($version_info)\n\n";
|
||||||
|
print " Date: " . localtime($start_time) . "\n";
|
||||||
|
print " Config: $config->{SRC_FILE}\n";
|
||||||
print "--------------------------------------------------------------------------------";
|
print "--------------------------------------------------------------------------------";
|
||||||
foreach my $config_vol (@{$config->{VOLUME}})
|
foreach my $config_vol (@{$config->{VOLUME}})
|
||||||
{
|
{
|
||||||
|
@ -1351,10 +1356,10 @@ MAIN:
|
||||||
# print(($_->{preserve} ? "===" : "---") . " $_->{name}\n");
|
# print(($_->{preserve} ? "===" : "---") . " $_->{name}\n");
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
if($config_subvol->{subvol_deleted}) {
|
|
||||||
print "--- $_\n" foreach(@{$config_subvol->{subvol_deleted}});
|
|
||||||
}
|
|
||||||
print "+++ $config_subvol->{snapshot}\n" if($config_subvol->{snapshot});
|
print "+++ $config_subvol->{snapshot}\n" if($config_subvol->{snapshot});
|
||||||
|
if($config_subvol->{subvol_deleted}) {
|
||||||
|
print "--- $_\n" foreach(sort { $b cmp $a} @{$config_subvol->{subvol_deleted}});
|
||||||
|
}
|
||||||
foreach my $config_target (@{$config_subvol->{TARGET}})
|
foreach my $config_target (@{$config_subvol->{TARGET}})
|
||||||
{
|
{
|
||||||
if($config_target->{ABORTED}) {
|
if($config_target->{ABORTED}) {
|
||||||
|
@ -1366,10 +1371,10 @@ MAIN:
|
||||||
# print(($_->{preserve} ? "===" : "---") . " $_->{name}\n");
|
# print(($_->{preserve} ? "===" : "---") . " $_->{name}\n");
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
if($config_target->{subvol_deleted}) {
|
|
||||||
print "--- $_\n" foreach(@{$config_target->{subvol_deleted}});
|
|
||||||
}
|
|
||||||
print "+++ $config_target->{subvol_created}\n" if($config_target->{subvol_created});
|
print "+++ $config_target->{subvol_created}\n" if($config_target->{subvol_created});
|
||||||
|
if($config_target->{subvol_deleted}) {
|
||||||
|
print "--- $_\n" foreach(sort { $b cmp $a} @{$config_target->{subvol_deleted}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1378,7 +1383,7 @@ MAIN:
|
||||||
print "Please check warning and error messages above.\n";
|
print "Please check warning and error messages above.\n";
|
||||||
}
|
}
|
||||||
if($dryrun) {
|
if($dryrun) {
|
||||||
print "\nNOTE: Dryrun was active, none of the operations below were actually executed!\n";
|
print "\nNOTE: Dryrun was active, none of the operations above were actually executed!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,16 @@
|
||||||
# Create snapshot into subdirectory
|
# Create snapshot into subdirectory
|
||||||
snapshot_dir _btrbk_snap
|
snapshot_dir _btrbk_snap
|
||||||
|
|
||||||
# Always create backups, even if the target volume is not reachable
|
# Always create snapshots, even if the target volume is unreachable
|
||||||
snapshot_create_always yes
|
snapshot_create_always yes
|
||||||
|
|
||||||
# Perform incremental backups
|
# Perform incremental backups (set to "strict" if you want to prevent
|
||||||
incremental strict
|
# creation of initial backups if no parent is found)
|
||||||
|
incremental yes
|
||||||
|
|
||||||
# ssh key for ssh volumes/targets
|
# ssh key for ssh volumes/targets
|
||||||
ssh_identity /etc/btrbk/ssh/id_ed25519
|
ssh_identity /etc/btrbk/ssh/id_ed25519
|
||||||
ssh_user root
|
ssh_user root
|
||||||
|
|
||||||
# Preserve weekly/monthly backups from given day of week
|
# Preserve weekly/monthly backups from given day of week
|
||||||
preserve_day_of_week sunday
|
preserve_day_of_week sunday
|
||||||
|
@ -29,19 +30,36 @@ target_preserve_monthly all
|
||||||
# Make sure the deletion of subvolumes is committed to disk when btrbk terminates
|
# Make sure the deletion of subvolumes is committed to disk when btrbk terminates
|
||||||
btrfs_commit_delete after
|
btrfs_commit_delete after
|
||||||
|
|
||||||
|
# Dump verbose output of "btrfs receive" to a specified file. If set
|
||||||
|
# to "sidecar", the file will be named "<backup_subvolume>.btrbk.log".
|
||||||
|
# Note that this log file can become very big, as every change of
|
||||||
|
# every file is being logged.
|
||||||
|
#receive_log /var/log/btrbk_receive.log
|
||||||
|
#receive_log sidecar
|
||||||
|
receive_log no
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
# Volume section: "volume <vol_dir>"
|
# Volume section: "volume <vol_dir>"
|
||||||
# <vol_dir>: Directory of a btrfs volume (or subvolume) containing the
|
# <vol_dir>: Directory of a btrfs volume (or subvolume) containing the
|
||||||
# subvolume to be backuped (usually the mount-point of a
|
# subvolume to be backuped (usually the mount-point of a
|
||||||
# btrfs filesystem mounted with subvolid=0 option)
|
# btrfs filesystem mounted with subvolid=0 option)
|
||||||
#
|
#
|
||||||
# Subvolume section: "subvolume <subvol>
|
# Subvolume section: "subvolume <subvol>
|
||||||
# <subvol>: Subvolume to be backuped, relative to <vol_dir> in
|
# <subvol>: Subvolume to be backuped, relative to <vol_dir> in
|
||||||
# volume section
|
# volume section
|
||||||
|
#
|
||||||
|
# Target section: "target <type> <vol_dir>"
|
||||||
|
# <type>: Backup type, currently only "send-receive"
|
||||||
|
# <vol_dir>: Directory of a btrfs volume (or subvolume) receiving the backups
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTE: The parser does not care about indentation, this is only for
|
||||||
|
# human readability. The options always apply to the last section
|
||||||
|
# encountered, overriding the corresponding option of the upper
|
||||||
|
# section. This means that the global options must be set before any
|
||||||
|
# "volume" section.
|
||||||
#
|
#
|
||||||
# Target section: "target <type> <subvol_dir>"
|
|
||||||
# <type>: Backup type, currently only "send-receive"
|
|
||||||
# <subvol_dir>: Directory of a btrfs volume (or subvolume) receiving the backups
|
|
||||||
|
|
||||||
volume /mnt/btr_system
|
volume /mnt/btr_system
|
||||||
subvolume root_gentoo
|
subvolume root_gentoo
|
||||||
|
@ -58,7 +76,6 @@ volume /mnt/btr_system
|
||||||
target_preserve_weekly 0
|
target_preserve_weekly 0
|
||||||
|
|
||||||
target send-receive /mnt/btr_backup/_btrbk
|
target send-receive /mnt/btr_backup/_btrbk
|
||||||
receive_log sidecar
|
|
||||||
|
|
||||||
|
|
||||||
volume /mnt/btr_data
|
volume /mnt/btr_data
|
||||||
|
|
Loading…
Reference in New Issue