| 1 |
% bup-prune-older(1) bup %BUP_VERSION% | bup %BUP_VERSION% |
| 2 |
% Rob Browning <[email protected]> |
| 3 |
% %BUP_DATE% |
| 4 |
|
| 5 |
# NAME |
| 6 |
|
| 7 |
bup-prune-older - remove older saves |
| 8 |
|
| 9 |
# SYNOPSIS |
| 10 |
|
| 11 |
bup prune-older [options...] <*branch*...> |
| 12 |
|
| 13 |
# DESCRIPTION |
| 14 |
|
| 15 |
`bup prune-older` removes (permanently deletes) all saves except those |
| 16 |
preserved by the various keep arguments detailed below. At least one |
| 17 |
keep argument must be specified. This command is equivalent to a |
| 18 |
suitable `bup rm` invocation followed by `bup gc`. |
| 19 |
|
| 20 |
WARNING: This is one of the few bup commands that modifies your |
| 21 |
archive in intentionally destructive ways. Though if an attempt to |
| 22 |
`join` or `restore` the data you still care about after a |
| 23 |
`prune-older` succeeds, that's a fairly encouraging sign that the |
| 24 |
commands worked correctly. (The `dev/compare-trees` command in the |
| 25 |
source tree can be used to help test before/after results.) |
| 26 |
|
| 27 |
# KEEP PERIODS |
| 28 |
|
| 29 |
A `--keep` PERIOD (as required below) must be an integer followed by a |
| 30 |
scale, or "forever". For example, 12y specifies a PERIOD of twelve |
| 31 |
years. Here are the valid scales: |
| 32 |
|
| 33 |
- s indicates seconds |
| 34 |
- min indicates minutes (60s) |
| 35 |
- h indicates hours (60m) |
| 36 |
- d indicates days (24h) |
| 37 |
- w indicates weeks (7d) |
| 38 |
- m indicates months (31d) |
| 39 |
- y indicates years (366d) |
| 40 |
- forever is infinitely far in the past |
| 41 |
|
| 42 |
As indicated, the PERIODS are computed with respect to the current |
| 43 |
time, or the `--wrt` value if specified, and do not respect any |
| 44 |
calendar, so `--keep-dailies-for 5d` means a period starting exactly |
| 45 |
5 * 24 * 60 * 60 seconds before the starting point. |
| 46 |
|
| 47 |
# OPTIONS |
| 48 |
|
| 49 |
\--keep-all-for PERIOD |
| 50 |
: when no smaller time scale `--keep` option applies, retain all saves |
| 51 |
within the given period. |
| 52 |
|
| 53 |
\--keep-dailies-for PERIOD |
| 54 |
: when no smaller time scale `--keep` option applies, retain the |
| 55 |
newest save for any day within the given period. |
| 56 |
|
| 57 |
\--keep-monthlies-for PERIOD |
| 58 |
: when no smaller time scale `--keep` option applies, retain the |
| 59 |
newest save for any month within the given period. |
| 60 |
|
| 61 |
\--keep-yearlies-for PERIOD |
| 62 |
: when no smaller time scale `--keep` option applies, retain the |
| 63 |
newest save for any year within the given period. |
| 64 |
|
| 65 |
\--wrt UTC_SECONDS |
| 66 |
: when computing a keep period, place the most recent end of the |
| 67 |
range at UTC\_SECONDS, and any saves newer than this will be kept. |
| 68 |
|
| 69 |
\--pretend |
| 70 |
: don't do anything, just list the actions that would be taken to |
| 71 |
standard output, one action per line like this: |
| 72 |
|
| 73 |
- SAVE |
| 74 |
+ SAVE |
| 75 |
... |
| 76 |
|
| 77 |
\--gc |
| 78 |
: garbage collect the repository after removing the relevant saves. |
| 79 |
This is the default behavior, but it can be avoided with `--no-gc`. |
| 80 |
|
| 81 |
\--gc-threshold N |
| 82 |
: only rewrite a packfile if it's over N percent garbage; otherwise |
| 83 |
leave it alone. The default threshold is 10%. |
| 84 |
|
| 85 |
-*#*, \--compress *#* |
| 86 |
: set the compression level when rewriting archive data to # (a |
| 87 |
value from 0-9, where 9 is the highest and 0 is no compression). |
| 88 |
The default is 1 (fast, loose compression). |
| 89 |
|
| 90 |
-v, \--verbose |
| 91 |
: increase verbosity (can be specified more than once). |
| 92 |
|
| 93 |
# NOTES |
| 94 |
|
| 95 |
When `--verbose` is specified, the save periods will be summarized to |
| 96 |
standard error with lines like this: |
| 97 |
|
| 98 |
keeping monthlies since 1969-07-20-201800 |
| 99 |
keeping all yearlies |
| 100 |
... |
| 101 |
|
| 102 |
It's possible that the current implementation might not be able to |
| 103 |
format the date if, for example, it is far enough back in time. In |
| 104 |
that case, you will see something like this: |
| 105 |
|
| 106 |
keeping yearlies since -30109891477 seconds before 1969-12-31-180000 |
| 107 |
... |
| 108 |
|
| 109 |
# EXAMPLES |
| 110 |
|
| 111 |
# Keep all saves for the past month, and any newer monthlies for |
| 112 |
# the past year. Delete everything else. |
| 113 |
$ bup prune-older --keep-all-for 1m --keep-monthlies-for 1y |
| 114 |
|
| 115 |
# Keep all saves for the past 6 months and delete everything else, |
| 116 |
# but only on the semester branch. |
| 117 |
$ bup prune-older --keep-all-for 6m semester |
| 118 |
|
| 119 |
# SEE ALSO |
| 120 |
|
| 121 |
`bup-rm`(1), `bup-gc`(1), and `bup-fsck`(1) |
| 122 |
|
| 123 |
# BUP |
| 124 |
|
| 125 |
Part of the `bup`(1) suite. |