mirror of https://github.com/digint/btrbk
btrbk: add btrbk archive --raw option
parent
dcc57abac4
commit
3e40903720
20
btrbk
20
btrbk
|
@ -4894,8 +4894,11 @@ MAIN:
|
||||||
|
|
||||||
my @config_override_cmdline;
|
my @config_override_cmdline;
|
||||||
my @exclude_cmdline;
|
my @exclude_cmdline;
|
||||||
my ($config_cmdline, $preserve_snapshots, $preserve_backups, $wipe_snapshots, $skip_snapshots, $skip_backups, $print_schedule, $lockfile_cmdline);
|
my ($config_cmdline, $lockfile_cmdline, $print_schedule,
|
||||||
my $resume_only_DEPRECATED; # as of btrbk-v0.26.0
|
$preserve_snapshots, $preserve_backups, $wipe_snapshots, $skip_snapshots, $skip_backups,
|
||||||
|
$archive_raw,
|
||||||
|
$resume_only_DEPRECATED, # as of btrbk-v0.26.0
|
||||||
|
);
|
||||||
unless(GetOptions(
|
unless(GetOptions(
|
||||||
'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; },
|
'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; },
|
||||||
'version' => sub { VERSION_MESSAGE(); exit 0; },
|
'version' => sub { VERSION_MESSAGE(); exit 0; },
|
||||||
|
@ -4917,6 +4920,7 @@ MAIN:
|
||||||
'print-schedule|S' => \$print_schedule,
|
'print-schedule|S' => \$print_schedule,
|
||||||
'lockfile=s' => \$lockfile_cmdline,
|
'lockfile=s' => \$lockfile_cmdline,
|
||||||
'override=s' => \@config_override_cmdline, # e.g. --override=incremental=no
|
'override=s' => \@config_override_cmdline, # e.g. --override=incremental=no
|
||||||
|
'raw' => \$archive_raw,
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
VERSION_MESSAGE();
|
VERSION_MESSAGE();
|
||||||
|
@ -5357,8 +5361,8 @@ MAIN:
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
my $archive_root = vinfo($archive_url, $config);
|
my $archive_root = vinfo($archive_url, $config);
|
||||||
unless(vinfo_init_root($archive_root)) {
|
unless($archive_raw ? vinfo_init_raw_root($archive_root) : vinfo_init_root($archive_root)) {
|
||||||
ERROR "Failed to fetch subvolume detail for '$archive_root->{PRINT}'" . ($err ? ": $err" : "");
|
ERROR "Failed to fetch " . ($archive_raw ? "raw target metadata" : "subvolume detail") . " for '$archive_root->{PRINT}'" . ($err ? ": $err" : "");
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5384,7 +5388,7 @@ MAIN:
|
||||||
};
|
};
|
||||||
my $config_droot = { CONTEXT => "archive_target",
|
my $config_droot = { CONTEXT => "archive_target",
|
||||||
PARENT => $config_sroot,
|
PARENT => $config_sroot,
|
||||||
target_type => "send-receive", # macro_send_receive checks this
|
target_type => ($archive_raw ? "raw" : "send-receive"), # macro_send_receive checks this
|
||||||
url => $droot_url, # ABORTED() needs this
|
url => $droot_url, # ABORTED() needs this
|
||||||
};
|
};
|
||||||
$config_sroot->{SUBSECTION} = [ $config_droot ];
|
$config_sroot->{SUBSECTION} = [ $config_droot ];
|
||||||
|
@ -5400,8 +5404,8 @@ MAIN:
|
||||||
|
|
||||||
my $droot = vinfo($droot_url, $config_droot);
|
my $droot = vinfo($droot_url, $config_droot);
|
||||||
vinfo_assign_config($droot);
|
vinfo_assign_config($droot);
|
||||||
unless(vinfo_init_root($droot)) {
|
unless($archive_raw ? vinfo_init_raw_root($droot) : vinfo_init_root($droot)) {
|
||||||
DEBUG("Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
DEBUG "Failed to fetch " . ($archive_raw ? "raw target metadata" : "subvolume detail") . " for '$droot->{PRINT}'" . ($err ? ": $err" : "");
|
||||||
unless(system_mkdir($droot)) {
|
unless(system_mkdir($droot)) {
|
||||||
ABORTED($droot, "Failed to create directory: $droot->{PRINT}/");
|
ABORTED($droot, "Failed to create directory: $droot->{PRINT}/");
|
||||||
WARN "Skipping archive target \"$droot->{PRINT}\": " . ABORTED_TEXT($droot);
|
WARN "Skipping archive target \"$droot->{PRINT}\": " . ABORTED_TEXT($droot);
|
||||||
|
@ -5416,7 +5420,7 @@ MAIN:
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# after directory is created, try to init again
|
# after directory is created, try to init again
|
||||||
unless(vinfo_init_root($droot)) {
|
unless($archive_raw ? vinfo_init_raw_root($droot) : vinfo_init_root($droot)) {
|
||||||
ABORTED($droot, "Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
ABORTED($droot, "Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
||||||
WARN "Skipping archive target \"$droot->{PRINT}\": " . ABORTED_TEXT($droot);
|
WARN "Skipping archive target \"$droot->{PRINT}\": " . ABORTED_TEXT($droot);
|
||||||
next;
|
next;
|
||||||
|
|
|
@ -237,7 +237,7 @@ as it is still required in order to determine the latest
|
||||||
snapshot/backup pair (which is always preserved, regardless of the
|
snapshot/backup pair (which is always preserved, regardless of the
|
||||||
retention policy).
|
retention policy).
|
||||||
|
|
||||||
*archive* <source> <target>::
|
*archive* <source> <target> [--raw]::
|
||||||
Recursively copy all subvolumes created by btrbk from <source> to
|
Recursively copy all subvolumes created by btrbk from <source> to
|
||||||
<target> directory, optionally rescheduled using
|
<target> directory, optionally rescheduled using
|
||||||
'archive_preserve_*' configuration options. Also creates directory
|
'archive_preserve_*' configuration options. Also creates directory
|
||||||
|
@ -250,6 +250,9 @@ need to create them by hand (e.g. by running "btrfs subvolume create
|
||||||
<target>/dir"). Check the output of --dry-run if unsure.
|
<target>/dir"). Check the output of --dry-run if unsure.
|
||||||
+
|
+
|
||||||
Note that this feature needs a *linux kernel >=4.4* to work correctly!
|
Note that this feature needs a *linux kernel >=4.4* to work correctly!
|
||||||
|
+
|
||||||
|
If '--raw' option is set, creates raw targets (experimental, see
|
||||||
|
btrbk.conf(5), TARGET TYPES).
|
||||||
|
|
||||||
*clean* [filter...]::
|
*clean* [filter...]::
|
||||||
Delete incomplete (garbled) backups. Incomplete backups can be
|
Delete incomplete (garbled) backups. Incomplete backups can be
|
||||||
|
|
Loading…
Reference in New Issue