From 5bdc3e527ba4a47ac0d07915a2aac047e5ece836 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Thu, 28 Sep 2017 13:18:40 +0200 Subject: [PATCH] btrbk: add "prune" command --- ChangeLog | 1 + btrbk | 8 ++++++++ doc/btrbk.1 | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index db16c8c..98a20ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ btrbk-current * Add "resume" command, replacement for "-r, --resume-only" command line option (which is now deprecated). * Add "snapshot" command (close #150). + * Add "prune" command. * Add "--preserve-snapshots" and "--preserve-backups" options. * Change raw backup format (sidecar file instead of uuid in file). * Honor target_preserve for raw targets (delete raw targets). diff --git a/btrbk b/btrbk index 4a7cdfa..a2a6a3c 100755 --- a/btrbk +++ b/btrbk @@ -315,6 +315,7 @@ sub HELP_MESSAGE print STDERR " dryrun don't run btrfs commands; show what would be executed\n"; print STDERR " snapshot run snapshot operations only\n"; print STDERR " resume run backup operations, and delete snapshots\n"; + print STDERR " prune only delete snapshots and backups\n"; print STDERR " stats print snapshot/backup statistics\n"; print STDERR " list available subcommands are:\n"; print STDERR " backups all backups and corresponding snapshots\n"; @@ -4226,6 +4227,13 @@ MAIN: $args_allow_group = 1; @filter_args = @ARGV; } + elsif($command eq "prune") { + $action_run = 1; + $skip_snapshots = 1; + $skip_backups = 1; + $args_allow_group = 1; + @filter_args = @ARGV; + } elsif ($command eq "clean") { $action_clean = 1; @filter_args = @ARGV; diff --git a/doc/btrbk.1 b/doc/btrbk.1 index 72f9635..8c47b28 100644 --- a/doc/btrbk.1 +++ b/doc/btrbk.1 @@ -223,6 +223,17 @@ retention policy. Use in conjunction with \-p, \-\-preserve, backup and/or snapshot deletion (steps 3, 4). .RE .PP +.B prune +[filter...] +.RS 4 +Prune snapshots and backups: skips snapshot and backup creation (steps +1, 2), only deletes snapshots and backups in order to satisfy their +configured retention policy. Useful for cleaning the disk after +changing the retention policy. Use in conjunction with +\-\-preserve\-backups, \-\-preserve\-snapshots if you want to skip +backup or snapshot deletion (steps 3, 4). +.RE +.PP .B archive .I *experimental*