Axel Burri
fe9ce255c5
remove experimental tag on "btrbk archive"
2019-04-24 19:22:30 +02:00
Axel Burri
6115cbdace
btrbk: make target_type optional for "target" section
2019-04-24 13:51:52 +02:00
Axel Burri
32d92ff3b7
btrbk: allow space separated groups
2019-04-20 14:05:42 +02:00
Axel Burri
0a2c5dbfb3
btrbk: use transaction for mkdir (cosmetics)
...
Prints correct "dryrun_success" (instead of "DRYRUN") in transaction
log.
2019-04-18 17:28:15 +02:00
Axel Burri
3d2936d40c
btrbk: fix regression for "btrbk archive -n"
...
resolve by mountpoint needs VINFO_MOUNTPOINT, which was not inserted
on fake mkdir:
514e69243a
btrbk: add "incremental_resolve" configuration option
2019-04-18 17:24:38 +02:00
Axel Burri
e36289a769
btrbk: use "archive_target" config context for archives
...
Distinguish normal "target" and (generated) "archive_target"
configuration context (printed in transaction log for
"abort_<context>" actions).
2019-04-18 16:40:25 +02:00
Axel Burri
a7da44cf2f
btrbk: bugfix: print aborted subvolumes to transaction log
...
Print all (deferred) actions to transaction log (file, syslog) in
init_transaction_log(), e.g. ABORTED() in "expand subvolume globs".
2019-04-18 16:28:53 +02:00
Axel Burri
25f0a76e28
btrbk: cosmetics: fix error message
2019-04-18 16:28:45 +02:00
Axel Burri
45b24d6477
documentation: btrbk.1: add "exclude" command line option
2019-04-18 15:09:15 +02:00
Axel Burri
95819f03ea
documentation: btrbk.1: cosmetics: same order for options in all docs
2019-04-18 15:09:15 +02:00
Axel Burri
b2f434b396
btrbk: add "exclude" command line option
2019-04-18 15:09:15 +02:00
Axel Burri
f0cff5ee5a
btrbk: add vinfo_filter_statement framework
2019-04-18 15:09:15 +02:00
Axel Burri
6e7d649588
btrbk: add "noauto" configuration option
2019-04-18 15:09:15 +02:00
Axel Burri
ae004e48fd
btrbk: map empty value to "yes" in configuration
2019-04-18 15:09:15 +02:00
Axel Burri
1503a07ad1
btrbk: enhance ABORTED framework (distinguish skipped and aborted)
2019-04-18 15:09:15 +02:00
Axel Burri
4224577960
btrbk: distinguish filter_args and subvol_args
...
preparatory for noauto and exclude options
2019-04-18 15:09:11 +02:00
Axel Burri
ff23e9605b
btrbk: cosmetics: fix snapshot create debug log
...
Add additional log line, containing context for subsequent lines
2019-04-12 21:04:49 +02:00
Axel Burri
5697c38e4a
btrbk: globally rename snapshot_children to related_snapshots
...
As a consequence, also rename $child -> $snapshot
2019-04-12 21:04:49 +02:00
Axel Burri
0a93f69135
btrbk: treat all related readonly subvolumes within snapdir as "snapshots"
...
With this, previous snapshots (far relations) are still listed when
restoring a snapshot.
Example (S = source subvolume, readwrite):
After 3 snapshots:
A->S, B->S, C->S
Restore B: `btrfs subvol delete S; btrfs subvol snapshot B S'`
A->S, B->S, C->S, S'->B
Previous implementation would show now snapshots for S', as no
snapshot has parent_uuid=S'.
New implementation shows A, B, C as snapshots for S', as orphaned
siblings (A, B, C pointing to deleted S) are also related.
2019-04-12 21:04:48 +02:00
Axel Burri
adfdf925e2
btrbk: add btrbk_direct_leaf option for vinfo_resolved()
2019-04-12 21:04:48 +02:00
Axel Burri
318126b831
btrbk: disallow unrelated (by parent_uuid) parents for btrfs-send if incremental=strict
...
Makes sure that if, for whatever reason, a subvolume having correct
btrbk name scheme does NOT share any extents with previous snapshots
is never used as parent.
Note that if a related parent is found, the unrelated closest
older/newer (by btrbk timestamp) subvolumes are still added as clone
sources.
2019-04-12 21:03:40 +02:00
Axel Burri
c407d41db2
btrbk: unconditionally add clone sources to btrfs-send if necessary
...
Preferences for parent (and required clone sources):
1. closest older in snapdir (by btrbk timestamp), related
2. closest older related (by cgen)
3. closest newer related (by cgen)
4. closest older in snapdir (by btrbk timestamp)
5. closest newer in snapdir (by btrbk timestamp)
Note: prefering 1 over 2 helps keeping parent-chain within droot on
target (assuming that btrfs always uses correlated parent on
btrfs-receive).
This will e.g. add a clone source on "btrbk resume", if both older AND
newer snapshot/backup pairs exists.
Also makes sure that the closest older btrbk snapshot is always added
as clone source, even if another related subvolume has newer cgen.
2019-04-11 16:19:48 +02:00
Axel Burri
95e25eb2d1
btrbk: fix get_related_subvolume_nodes: add all parents and orphaned siblings
...
Old implementation was missing last readonly parent in chain, as well
as orphaned siblings.
Also sort all by cgen, not by distance, then cgen.
Also skip self.
2019-04-11 16:16:00 +02:00
Axel Burri
20c390893a
btrbk: honor multiple -v command line options (increase loglevel)
2019-04-05 19:29:37 +02:00
Axel Burri
44edc97aef
btrbk: add "incremental_clones" configuration option (btrfs-send <clone-src>)
2019-04-05 12:06:41 +02:00
Axel Burri
f38c69316f
btrbk: get_best_parent(): add clone_src argument
2019-04-05 12:05:46 +02:00
Axel Burri
7cf1bfb354
btrbk: rename functions (use "correlated" where applicable)
...
_receive_target_nodes -> _correlated_nodes
get_best_receive_target -> get_best_correlated_target
2019-04-05 12:05:46 +02:00
Axel Burri
ce81350df0
btrbk: remove unused function: vinfo_subvol_list_all_accessible()
2019-04-05 12:05:46 +02:00
Axel Burri
514e69243a
btrbk: add "incremental_resolve" configuration option
...
Allowed values for "incremental_resolve":
- "mountpoint" (default): Use parents in the filesystem tree below
mount points of source `<volume-directory>/<snapshot-dir>` and
target `<target-directory>`.
- "directory": Use parents strictly below source/target
directories. Useful when restricting access, e.g. when using
ssh_filter_btrbk.sh.
- "_all_accessible" (experimental): Use parents from all mount points.
Note that using "_all_accessible" causes btrfs-progs to fail:
- btrfs send -p: "ERROR: not on mount point: /path/to/mountpoint"
- btrfs receive: "ERROR: parent subvol is not reachable from inside the root subvol"
see also: https://github.com/kdave/btrfs-progs/issues/96
2019-04-05 12:05:46 +02:00
Axel Burri
d64e237e94
btrbk: get_best_parent: consider all parent/child relations
2019-04-05 12:05:46 +02:00
Axel Burri
cb23c65eed
btrbk: get_related_subvolumes: add direct children from parent chain
2019-04-05 12:05:46 +02:00
Axel Burri
c1268cdd66
btrbk: table_format "transaction": make "*host" and "*port" keys skip-row-if-empty (for consistency)
2019-04-04 17:09:59 +02:00
Axel Burri
cba4a93152
btrbk: table_formats: add "*port" keys (skip-row-if-empty)
2019-04-01 20:12:33 +02:00
Axel Burri
ca3bd505ef
btrbk: make check for duplicate snapshot/backup locations aware of shared btr_tree
...
Build check hash within btr_tree node instead per URL. This makes it
aware of shared btr_tree (different hostname:port pointing to same
btrfs filesystem).
2019-04-01 18:43:53 +02:00
Axel Burri
2f09a9a723
btrbk: virtual machine setups; use MACHINE_ID for caches; use port in URL
...
Common virtual machine setups have multiple volume sections with same
host, but distinct port numbers for each machine.
- make caches dependent on MACHINE_ID instead of HOST
- append port number to URL
- add MACHINE_ID to vinfo
- use MACHINE_ID where applicable
This even works if virtual machines share the same btrfs filesystems:
If a equal UUID is found on distinct machines, btr_tree() will return
the already present tree, in order to be consistent after node
injections.
2019-04-01 18:43:49 +02:00
Axel Burri
d8b7988ffa
btrbk: deprecate ssh_port option in favor of ssh://hostname[:port] notation
...
Setting the ssh port directly in the "volume" / "target" config lines
adds the possibility to have a create a unique "hostname:port"
identifier (preparatory for MACHINE_ID to distinguish virtual machines
on same host with different ports.)
2019-04-01 18:26:07 +02:00
Axel Burri
318e3af088
btrbk: table_formats: add skip-row-if-empty flag on all "*host"
2019-04-01 18:24:30 +02:00
Axel Burri
716d420a40
btrbk: print_formatted: add skip-row-if-empty functionality for table_formats
...
If the row key is prefixed with "-", and is all <undef>, omit output
of this row.
2019-04-01 18:22:30 +02:00
Axel Burri
0afc455c40
btrbk: fix table format "resolved": add target_type=send-receive|raw; add missing target_rsh
...
Required for "btrbk-check", which must be able do distinguish between
"send-receive" and "raw" targets.
2019-04-01 16:27:39 +02:00
Axel Burri
0699a860a9
btrbk: cosmetics: remove horizonal line in help message
...
This was added by mistake in:
96956959
btrbk: cosmetics: use heredocs for the help message
2019-04-01 15:31:58 +02:00
Axel Burri
e3a81c8126
btrbk: do not print help message if -q,--quiet is set
...
When called from another script, we dont want the help message printed
on errors. E.g. when running something like:
btrbk list snapshots -q filter_which_does_not_match
2019-04-01 15:31:58 +02:00
Axel Burri
6d465da6dc
btrbk: change version to 0.28.0-dev; bump copyright year
2019-03-29 04:35:35 +01:00
Axel Burri
bb2e9877b0
change version to 0.27.2
2019-03-26 15:08:55 +01:00
Axel Burri
6f68b713ee
btrbk: fix scheduler when overriding "target_preserve_min" in combination with global "target" section
...
When configuring "target" in a global (or "volume") context, and
overriding target_preserve_min in "subvolume" section, the scheduler
has undefined behavior (mixing up the "min" values).
Fixed by returning a copy of the preserve hash in
config_preserve_hash().
2019-03-04 16:05:38 +01:00
Axel Burri
17957a163a
btrbk: trigger autofs mount while resolving mountpoints
...
If resolved mount point has fs_type=autofs, trigger automount by
calling "btrfs subvolume show" on the mount point, and check mountinfo
again.
2019-01-17 16:43:42 +01:00
Axel Burri
f37a638f30
btrbk: bump version to 0.27.2-dev
2019-01-17 16:43:39 +01:00
Axel Burri
bd66f83663
btrbk: bump to forgotten dependency >= btrfs-progs-4.12 (as of btrbk-0.27.0)
...
dependency introduced in:
0acbf74c
btrbk: add btrfs_subvolume_list_complete: fetch all subvolumes with all flags
2018-12-25 22:20:24 +01:00
Axel Burri
e879620195
change version to 0.27.1
2018-12-05 22:18:19 +01:00
Axel Burri
0e6c1f9025
btrbk: fix regression: call "sudo readlink" for backend=btrfs-progs-sudo
...
It is possible that the subvolume path is not accessible by the user
calling btrbk. When resolving mount points, "readlink" is used on the
path, which also needs to be wrapped with "sudo".
2018-12-05 22:01:07 +01:00
Axel Burri
ff011d55af
btrbk: fix "config print" command (undefined value in format_preserve_matrix())
...
regression: 5791d72171
btrbk: add "preserve_hour_of_day" configuration option
2018-12-05 21:43:54 +01:00
Axel Burri
de851955b6
btrbk: print_formatted: no blank lines for format: raw,tlog,syslog
2018-10-31 14:33:07 +01:00
Axel Burri
ebaaee2139
btrbk: print_formatted: omit title for format: raw,tlog,syslog
2018-10-31 14:06:14 +01:00
Axel Burri
74873081c3
btrbk: bump version to 0.27.1-dev
2018-10-31 13:57:06 +01:00
Axel Burri
c59488f405
change version to 0.27.0
2018-10-16 12:19:44 +02:00
Axel Burri
56ee8acf3b
btrbk: add "-S" command line option (shortcut for --print-schedule)
2018-10-15 16:25:07 +02:00
Axel Burri
7a8df85f2e
btrbk: fix regression: add node to return value of vinfo_resolved()
...
The FORCE_PRESERVE information is set on the node, and was lost for
"latest common target" as get_receive_targets() returned vinfo without
node information.
fixes regression: 6c502cb
btrbk: search complete target tree for correlated subvolumes
2018-10-15 16:19:52 +02:00
Axel Burri
3528927ea6
btrbk: bugfix: do not keep latest common snapshot for "incremental no"
...
There is no reason to keep the latest common source snapshot if
"incremental no" is configured (see #252 ).
2018-10-02 17:28:46 +02:00
Axel Burri
069304f3bb
btrbk: use system_list_mountinfo(), remove system_list_mounts(); rename fs_spec -> mount_source
...
Reasons for changing to `cat /proc/self/mountinfo`:
- `/proc/self/mounts` (or `/proc/mounts`) lacks extra info
(namespaces) and is not documented in kernel (deprecated?).
- findmnt(8) also uses /proc/self/mountinfo
Refs:
- https://www.kernel.org/doc/Documentation/filesystems/proc.txt
- https://bugzilla.redhat.com/show_bug.cgi?id=491924
- https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable.git/commit/?id=2d4d4864ac08caff5c204a752bd004eed4f08760
2018-08-27 14:54:32 +02:00
Axel Burri
e02c2cf249
btrbk: add system_list_mountinfo: parse /proc/self/mountinfo
...
preparatory patch for removing system_list_mounts().
2018-08-27 14:52:28 +02:00
Axel Burri
37c0e840e9
btrbk: bugfix: use latest longest match for resolving mount point (e.g. for autofs)
2018-08-27 14:49:04 +02:00
Axel Burri
0d124a4373
btrbk: fix regression in get_related_subvolumes(): correctly match same btrbk file name scheme
...
Since we consider all accessible subvolumes in get_related_subvolumes,
checking for equal BTRBK_BASENAME and empty SUBVOL_DIR does not work
when checking for same btrbk file name scheme.
fixes regression: b37ef84e36
(btrbk: always read mountpoints; include all snapshots from mountpoint as candidates for best common parent)
2018-07-18 16:13:33 +02:00
Axel Burri
bf5fd7a90b
btrbk: cosmetics: fix prototype of get_related_subvolumes()
2018-07-18 16:13:29 +02:00
Axel Burri
1242913d9b
btrbk: cosmetics: rename variables (spec -> fs_spec)
2018-07-12 18:26:35 +02:00
Axel Burri
47f6f730ab
btrbk: cosmetics: change error message in btrfs_subvolume_delete; add comments
2018-07-12 18:26:35 +02:00
Axel Burri
faec212324
btrbk: check if received subvolume is really garbled before deleting it
...
Improve error handling in btrfs_send_receive: on error, always try to
read the target subvolume and only delete it automatically if it is
garbled (read/write, no received_uuid).
This is especially important if the target subvolume was already
present before send/receive.
Reverts: 4c4afe77
btrbk: skip target metadata test if send/receive has errors
2018-07-12 18:26:35 +02:00
Axel Burri
de57efff82
btrbk: bugfix: print all errors if send/receive fails
...
If stream_compress is enabled and compress command is not found, we
now print "command not found".
2018-07-12 18:26:34 +02:00
Axel Burri
9aeaf2b15c
btrbk: fix regression introduced with btrfs_subvolume_list_complete
...
If btrfs_subvolume_show($vol, rootid => 5) fails, there are no
"received_uuid" and no "gen" keys in the root node.
Fixes: 0acbf74c57
(btrbk: add btrfs_subvolume_list_complete: fetch all subvolumes with all flags)
2018-07-09 18:46:24 +02:00
Axel Burri
669a34357a
btrbk: bugfix: handle corner case: url="ssh://my.host" (without trailing slash)
...
As we allow <url> to be specified as "<hostname>:<directory>", an URL
"ssh://my.host" (without trailing slash) was parsed as hostname="ssh",
directory="/my.host".
2018-07-09 16:13:48 +02:00
Axel Burri
0acbf74c57
btrbk: add btrfs_subvolume_list_complete: fetch all subvolumes with all flags
...
Wrapper, returns complete list of all subvolumes (including btrfs
root, id=5) with all flags. Requires three calls to btrfs-progs.
Adaptions and cleanup in btr_tree().
2018-07-09 16:13:00 +02:00
Axel Burri
d15133b3d4
btrbk: snapshot_name defaults to volume name if subvolume name is "."
2018-07-09 16:13:00 +02:00
Axel Burri
7088a91fa3
btrbk: cosmetics: sanitize trailing "/." in check_file()
2018-07-09 16:13:00 +02:00
Axel Burri
de5004c744
btrbk: abort subvolume if it is btrfs root (id=5)
...
Btrfs root subvolume (id=5) have no UUID and cannot be backed
up. Abort if "subvolume ." is configured on btrfs root, e.g.:
volume /path/to/btrfs_root
subvolume .
2018-07-09 16:13:00 +02:00
Axel Burri
b0d58fd0f1
btrbk: btr_tree: always read btrfs root node (id=5), hoping to get its uuid
...
Note that the UUID for btrfs root (id=5) is not always present:
- btrfs-progs < 4.12 does not support rootid lookup
- UUID can be missing if filesystem was created with btrfs-progs < 4.16
Still we need to always read it, as the whole tree is cached and we
don't know if it will be used.
2018-07-09 16:13:00 +02:00
Axel Burri
cb5e361f7a
btrbk: add --rootid command option for "btrfs subvolume show"
2018-07-09 16:13:00 +02:00
Axel Burri
1aa0fe1aad
btrbk: remove obsolete realpath_cache update in btrfs_subvolume_show()
...
Recent btrfs-progs do not print the real path any more, this is now
handled by btrfs_mountpoint() -> system_realpath().
2018-07-09 16:13:00 +02:00
Axel Burri
177671e920
btrbk: validate output of "btrfs subvolume show"; also return uuid for btrfs root (if present)
...
Filesystems created with btrfs-progs < 4.16 have valid UUID, while
others have not [1]. Validate output of "btrfs subvolume show", and
provide uuid for btrfs root (id=5) only if it is valid.
[1]: 0a0a03554a: btrfs-progs: mkfs: add uuid and otime to ROOT_ITEM of, FS_TREE
2018-07-09 16:13:00 +02:00
teesid
9c70231859
btrbk: allow backup of subvolume (subvolid != 5) mounted at "/"
...
It works with the configuration snippet below if subvolid != 5:
```
volume /
subvolume .
snapshot_name root
```
2018-07-09 16:13:00 +02:00
Axel Burri
a0f6b55d28
btrbk: fix regression: undefined array reference when no received_uuid present
...
fixes #239 (@ian-kelling)
2018-06-25 13:30:14 +02:00
Samantha McVey
211943d4af
btrbk: cosmetics: reformat a regex to be much more readable
2018-06-04 11:39:52 +02:00
Samantha McVey
969569592a
btrbk: cosmetics: use heredocs for the help message
...
Avoids use having to use 40 print's and having to quote each line and is
much easier to edit.
2018-06-04 11:39:03 +02:00
Axel Burri
391e50b872
btrbk: do not warn on non-parseable btrfs mountpoint
...
Many people use whitespace even in mountpoints, silently ignore
(loglevel=info) non-parseable btrfs mountpoints.
Btrbk does not support file names with whitespace or special
characters by design, and specifying such mountpoints in the
configuration file fails anyway.
2018-05-31 00:34:50 +02:00
Axel Burri
2f56c55120
btrbk: fix regression: actions "list snapshots/backups" print all snapshots under sroot (not snaproot)
...
Regression from: c457540ce3
2018-05-14 23:43:13 +02:00
Axel Burri
09918bf5af
btrbk: cosmetics: print (fix) reason why snapshots/backups are skipped/preserved
2018-05-11 00:17:52 +02:00
Axel Burri
9ae823a757
btrbk: cosmetics: remove too chatty debug log
2018-05-10 15:44:46 +02:00
Vít Novotný
c8fcb01bc2
btrbk: bugfix: do not read target btrfs tree on "btrbk snapshot --preserve"
...
If running "btrbk snapshot --preserve", there is no need to initialize
targets, and we don't want to warn and fail (exitcode=10) on missing
targets.
2018-05-10 15:18:36 +02:00
Axel Burri
17f41118d3
btrbk: bugfix: compare all mountpoints while resolving
...
When comparing longest match in mounts, all mountpoints have to be
taken into account (not only the btrfs mount points).
2018-05-10 14:02:44 +02:00
Axel Burri
1c83a6545d
btrbk: add filter capabilities to vinfo_subvol_list
...
Clean up (and speedup) code by filtering while building the list
instead of checking every item after building.
2018-05-10 11:48:34 +02:00
Axel Burri
a25487e873
btrbk: cosmetics (log messages)
2018-05-10 11:48:34 +02:00
Axel Burri
ef5c369a37
btrbk: use _is_same_fs_tree() where applicable
2018-05-10 11:48:34 +02:00
Axel Burri
0454f60ad1
btrbk: bugfix: match btrbk_basename in get_latest_snapshot_child()
2018-05-10 11:48:34 +02:00
Axel Burri
2c1c3b4d54
btrbk: cleanup: remove snapshot_dir, rename sroot->snaproot
2018-05-10 11:48:34 +02:00
Axel Burri
c457540ce3
btrbk: use separate vinfo for snapshot directory (allows snapshot_dir to be a mountpoint)
...
Instead of passing snapshot_dir all over the place, use a separate
vinfo for the snapshot directory, accessible by vinfo_snapshot_root().
As it is initialized separately by vinfo_init_root(), it can be on a
different mountpoint.
This also allows us to use different semantics for snapshot_dir in the
future, as it does not need to be relative to the volume directory.
2018-05-10 11:48:34 +02:00
Axel Burri
f5dc4e0a36
btrbk: add known mountpoints to btr_tree nodes as anchor for reverse lookup
2018-05-10 11:48:34 +02:00
Axel Burri
e9374b3b1d
btrbk: replace url_cache by spec_cache
2018-05-10 11:48:34 +02:00
Axel Burri
0ea0430c43
btrbk: cleanup (cosmetics, documentation)
2018-05-10 11:48:34 +02:00
Axel Burri
b37ef84e36
btrbk: always read mountpoints; include all snapshots from mountpoint as candidates for best common parent
...
Dropped readin of subvolid and realpath by btrfs_subvolume_show(), we
now always read /proc/self/mounts (and call readlink).
When picking the best common parent in get_best_parent(), we want to
list as many snapshots as possible. For now, we list all from the
mountpoint of snaproot ($sroot/<snapshot_dir>), due to a bug in
btrfs-progs [1]. Also added code (commented out) to list snapshots
from all known mountpoints.
[1] https://github.com/kdave/btrfs-progs/issues/96
2018-05-10 11:48:05 +02:00
Axel Burri
b549e11b43
btrbk: raw targets: move tree readin to separate function; add caching
...
Adds new function vinfo_init_raw_root(), similar to vinfo_init_root().
Note that we don't (yet) resolve realpath for raw targets.
2018-05-10 11:36:21 +02:00
Axel Burri
7a1bc257c1
btrbk: raw targets: create fake btr_tree instead of maintaining separate list
2018-05-10 11:36:21 +02:00
Axel Burri
6c502cbdcc
btrbk: search complete target tree for correlated subvolumes
...
- move matching for correlated subvolumes from get_receive_targets
into new function _receive_target_nodes
- add lookup tables in btr_tree (RECEIVED_UUID_HASH, UUID_HASH),
allowing for faster matching in _receive_target_nodes
- add vinfo_resolved() for mapping nodes to vinfo
- rename get_latest_common to get_best_parent (while moving some
functionality to new function get_related)
- cleanup
2018-05-10 11:36:21 +02:00
Axel Burri
490f680f41
btrbk: bugfix: add backend mappings for "btrfs filesystem usage"
2018-04-30 14:15:30 +02:00
Axel Burri
719fb5fb74
btrbk: bugfix: correct scheduling of "first weekly backup in month/year"
...
In the scheduler, a month (or year) does not start at the first day,
but at the first `preserve_day_of_week`. Make sure that all days
before `preserve_day_of_week` in a month get delta_months+1.
Example (corner case):
- `preserve_day_of_week sunday`
- `target_preserve *m`
- no backups in 2018-02
- backup with timestamp 2018-03-01 (which is a thursday)
- backup with timestamp 2018-03-04 (which is a sunday)
Without this patch, because there are no sunday backups in 2018-02,
the first backup is considered a weekly (+4d after sunday), and as
such "first weekly of month 2018-03", and the second one is discarded.
With this patch, the first item is considered "first weekly of month
2018-02", and the second gets "first weekly of month 2018-03".
NOTE: This change may result in (previously preserved) backups to be
deleted!
2018-04-05 18:00:29 +02:00
Axel Burri
e4a0938712
btrbk: ignore "preserve_hour_of_day" on snapshots/backups having "timestamp_format=short"
...
Snapshots and backups having no exact time information (created with
"timestamp_format=short") are set to 00:00, which would be regarded as
"previous day" if preserve_hour_of_day is greater than 0. Fix this by
ignoring preserve_hour_of_day in this case.
2018-04-05 18:00:29 +02:00
Axel Burri
c89ffd4213
btrbk: schedule: format preserve text only if needed
...
No functional changes, improves performance of schedule().
2018-04-05 18:00:24 +02:00
Thiodwitnir
5791d72171
btrbk: add "preserve_hour_of_day" configuration option
...
Introduces the new config option "preserve_hour_of_day" to specify
after what time backups should be considered as dailies.
Based on pull request #204 , with changes:
- calculation of weekly backups
- change format of preserve_matrix
2018-04-05 16:37:31 +02:00
Axel Burri
951ae256fa
btrbk: bump version to 0.27.0-dev
2018-04-05 16:26:57 +02:00
Axel Burri
1fd3a547df
change version to 0.26.1; bump copyright year
2018-03-05 11:55:56 +01:00
Axel Burri
6f38536052
btrbk: set c_default for config keys with computed default
...
Suppress "Option redefined" warning for snapshot_name config option,
which has hardcoded (computed) default already set when checking.
fix regression: 0ebe2ea2e1
2018-02-26 16:06:12 +01:00
Axel Burri
e75cf0c72c
btrbk: fix exit status and transaction log when archive_exclude is set
...
Similar to ABORTED=USER_SKIP (active commandline filter), archives
having ABORTED=ARCHIVE_EXCLUDE_SKIP (active archive_exclude
configuration) do not cause exit status 10 and are hidden from
transaction log.
2018-02-26 14:35:26 +01:00
Axel Burri
5651c96e4e
btrbk: archive: always print "[-]" if no action was performed for target
2018-02-14 00:18:44 +01:00
Axel Burri
8610e75459
btrbk: add archive_exclude configuration option
...
Support wildcard characters, matches against both "$sroot->{PATH}" and
"$sroot->{PATH}/$snapshot_name".
2018-02-13 22:50:23 +01:00
Axel Burri
0ebe2ea2e1
btrbk: add "allow_multiple" flag for config_options declaration; use for option "group"
2018-02-13 19:30:24 +01:00
Axel Burri
3aaafa3d88
btrbk: add "meta" context for config defaults
...
Preparatory patch to allow multiple identical config keys in same
section.
2018-02-13 19:28:38 +01:00
Axel Burri
b2b43cf199
btrbk: add configurable error_statement for check functions
...
Corrects error messages from --exclude option.
Applies to in check_file(), check_url() and append_config_option().
2018-02-13 17:40:14 +01:00
Axel Burri
db1fe2d11a
btrbk: fix output of "btrbk list backups" and "btrbk stats" (match all uuid/received_uuid combinations)
2018-02-07 16:24:49 +01:00
Axel Burri
a3641cff74
btrbk: fix filter statement matching for volume="/"
...
While $vol->{URL} can contain "//" if volume="/" (intentionally, this
is an assembled path), the filter statements are sanitized using
check_url(). This means we need to match the filter statement against
check_url($vol->{URL}). Same applies to subvol.
2018-02-03 12:55:21 +01:00
Axel Burri
90fed6525e
btrbk: bugfix: restrict snapshot_dir and snapshot_create to root/volume/subvolume context
2018-01-31 19:01:00 +01:00
Axel Burri
753d68b2ed
btrbk: add documentation on caching in btr_tree()
2018-01-30 14:02:36 +01:00
Axel Burri
84bac59ab4
btrbk: fix parsing of "openssl_iv_size" configuration option
2018-01-21 18:53:29 +01:00
Axel Burri
13f37491ed
btrbk: cosmetics: change order of commands in help message
2017-10-12 17:08:46 +02:00
Axel Burri
79cbf7c0c3
change version to 0.26.0
2017-10-12 00:39:06 +02:00
Axel Burri
909c68f164
btrbk: transaction_log and transaction_syslog are only allowed in root context
2017-10-11 20:54:41 +02:00
Axel Burri
d941ecfce9
documentation: change digint links to https://
2017-10-11 20:54:41 +02:00
Axel Burri
e3ee674085
btrbk: limit search depth to 256 when resolving ancestors
...
Note that the current implementation is not very optimized, we should
introduce a parent/child hash table for all queries in
get_latest_common().
2017-10-10 16:46:05 +02:00
Axel Burri
3be65b9f67
btrbk: resolve ancestors (recursive on parent_uuid chain) when searching for latest common subvolume
2017-10-10 13:10:33 +02:00
Axel Burri
0799820556
btrbk: support btrfs-progs 4.13.2: adapt parsing of "btrfs subvolume list"
...
btrfs-progs v4.13.2 changed the output of "btrfs subvolume list", in
order to make the tabular output format look nicer (?!?):
e4c6772f69
2017-10-09 23:04:07 +02:00
Axel Burri
e9a517f161
btrbk: add options "{snapshot,target,archive}_qgroup_destroy": destroy qgroups whenever a subvolume is deleted
...
Btrfs does not destroy qgroups when subvolumes are deleted (see
https://bugzilla.kernel.org/show_bug.cgi?id=91751 ). As a workaround
for this, btrbk can be configured to always destroy the corresponding
default qgroup "0/<subvol-id>" whenever a subvolume (snapshot, backup
or archive) is deleted.
Added configuration options:
- snapshot_qgroup_destroy
- target_qgroup_destroy
- archive_qgroup_destroy
2017-10-02 16:23:23 +02:00
Axel Burri
6cb98700d8
btrbk: allow archive_preserve_* options in root context only
2017-10-02 13:54:37 +02:00
Axel Burri
2e974c1f4f
btrbk: add "--wipe" command line option
2017-09-28 14:17:00 +02:00
Axel Burri
5bdc3e527b
btrbk: add "prune" command
2017-09-28 14:17:00 +02:00
Axel Burri
2809dc54c5
btrbk: remove sorting of deleted subvolumes in summary (not needed anymore)
...
Deleted subvolumes are already sorted by schedule().
Sorting by PATH is bad anyways, as it does not sort _NN postfix
correctly.
2017-09-28 14:17:00 +02:00
Axel Burri
512aca5332
btrbk: parse output of "btrfs subvolume delete"
...
When doing a batch delete (multiple deletes with one call to "btrfs
subvolume delete"), we want to know which subvolumes have failed. For
this, we need parse the error output.
On any parsing failure, we assume that nothing has been deleted, and
warn accordingly (forward compatibility).
2017-09-28 14:17:00 +02:00
Axel Burri
9d9527ca9a
btrbk: simplify transaction function calls
...
Prefix transaction status with "dryrun_" in start_transaction() /
end_transaction if $dryrun is set.
2017-09-28 14:17:00 +02:00
Axel Burri
422d52c063
btrbk: add key derivation for encrypted raw targets using external backend
2017-09-28 14:17:00 +02:00
Axel Burri
de7628ac7c
btrbk: add openssl_enc encryption for raw targets; add system_urandom()
...
Example:
Manually create a key:
# KEYFILE=/some/secure/place/btrbk.key
# dd if=/dev/urandom bs=1 count=32 | od -x -A n | tr -d "[:space:]" > $KEYFILE
btrbk.conf:
volume /mnt/btr_pool
incremental no
raw_target_encrypt openssl_enc
openssl_ciphername aes-256-cbc
openssl_iv_size 16 # NOTE: set to "no" if no IV is needed by the selected cipher
openssl_keyfile /some/secure/place/btrbk.key
subvolume home
target raw ssh://cloud.example.com/backup
2017-09-28 14:17:00 +02:00
Axel Burri
251c2fb2a1
btrbk: re-enable parsing of deprecated raw file format (uuid suffix)
2017-09-28 14:17:00 +02:00
Axel Burri
e804930b5e
btrbk: allow deletion of non-incremental raw targets
...
implemented directly in btrfs_subvolume_delete()
2017-09-28 14:17:00 +02:00
Axel Burri
cd8d7e3a0a
btrbk: use sidecar file "*.info" instead of encoding uuids into filename for raw targets
...
pros:
- better forward compatibility, e.g. symmetrical encryption
- better readability of files
cons:
- two files per backup
2017-09-28 14:16:53 +02:00
Axel Burri
571dae4428
btrbk: do not run in perl taint mode by default: remove "perl -T" in hashbang; hardcode $PATH only if taint mode is enabled
...
While taint mode [1] is a nice feature of perl, e.g. it disallows
using variables (such as filenames from the config file) which were
not validated in system() commands, it also treats $PATH as insecure
(which inherently is, as perl cannot know who messed around with it).
[1] perlsec(1): http://perldoc.perl.org/perlsec.html
[2] perlrun(1): http://perldoc.perl.org/perlrun.html
Note that btrbk still does all taint checks, and can be run in taint
mode:
- by executing `perl -T /usr/sbin/btrbk`,
- or by changing the hashbang to: `!#/usr/bin/perl -T`.
2017-09-25 17:53:35 +02:00
Axel Burri
5f867c2347
btrbk: run_cmd(): catch all possible errors when executing system command
2017-09-25 15:00:40 +02:00
Axel Burri
e402435dc8
btrbk: treat deprecated warnings as non-fatal
...
Despite FATAL warnings are discouraged in perl and may break forward
compatibility [1], we still use it as btrbk is usually run as root and
we really want perl to die on programmatic errors.
[1] "perldoc warnings"
2017-09-25 15:00:40 +02:00
Axel Burri
6c2d56d621
btrbk: action "clean": dont list failed deletes in summary
2017-09-21 12:39:48 +02:00
Axel Burri
f113436626
btrbk: bugfix: check path when expanding wildcards (warn and ignore if check fails)
...
Before this patch, btrbk errored (unsafe command), and then died.
Fixes #181 .
2017-09-11 18:49:14 +02:00
boerwastaken
d265c34149
btrbk: make SSH minimally chatty (always add '-q' option)
...
Fixes digint/btrbk#179 : When SSH is chatty (informing of host key
rollover etc) the remote command output parser borks.
2017-09-04 13:00:19 +02:00
Axel Burri
8eb88a8681
documentation: replace POD header with comments
2017-08-28 20:33:00 +02:00
Axel Burri
88aa8c1fea
btrbk: remove "duration" column from transaction_log/transaction_syslog
...
The "duration" column in the transaction log has proven to be
confusing to some users, especially on errors (e.g. "send-receive
ERROR 27" in issue #177 ). As it's not really necessary (duration can
be computed from the corresponding "starting" log entry), it's now
being dropped.
2017-08-28 17:55:27 +02:00
Axel Burri
6acea6a08d
btrbk: bugfix: print correct time in end_transaction()
2017-08-28 17:54:17 +02:00
Axel Burri
5428e9cd93
btrbk: add "resume" and "snapshot" commands; add --preserve-snapshots and --preserve-backups options; deprecate "-r, --resume-only" command line option
2017-08-21 13:23:20 +02:00
Axel Burri
a9f1b6b24a
change version to 0.25.1
2017-07-30 16:03:58 +02:00
Axel Burri
6cf5d59644
btrbk: add support for btrfs-progs 4.12: do not fail or set realpath_cache for relative paths in btrfs_subvolume_show()
...
As of btrfs-progs-v4.12, the "btrfs subvolume show" command does not
print the full (absolute, resolved) path anymore [1]. Instead, it prints
the relative path to btrfs root (or "/" if it is the root).
The impact for btrbk is that we cannot fill our realpath_cache in
btrfs_subvolume_show() anymore. This is not fatal, but has the
following consequences:
- The "check for duplicate snapshot locations" may now miss
subvolumes specified by symlinks.
- If multiple "volume" sections point to the same subvolume (e.g. if
specified using symlinks) an additional "btrfs subvolume list" is
called. Note that the subvolume will still be recognized as
identical, and the btr_tree will not be rebuilt.
[1] btrfs-progs commit: b7df24aa5cddc4802b9938f56372b73869775cd9
2017-07-30 15:25:32 +02:00
Axel Burri
26682213e2
btrbk: cleanup btrfs_subvolume_list() and comments
2017-07-30 15:03:23 +02:00
Axel Burri
356231bc2a
btrbk: abort if source subvolume has readonly or received_uuid flag
2017-07-29 19:03:23 +02:00
Axel Burri
c0c546eb4e
btrbk: stats command: show "correlated" status instead of "orphaned" (inverse logic which caused a lot of confusion)
2017-06-25 21:16:08 +02:00
Axel Burri
15bae5e051
btrbk: stats command: print up-to-date status on backups
2017-06-25 21:14:03 +02:00
Axel Burri
b2cc99b0fb
btrbk: bugfix: accept "no" for "transaction_log", "transaction_syslog" and "lockfile" configuration options
2017-06-25 18:06:06 +02:00
Axel Burri
315b3f24a1
btrbk: add config option "stream_buffer <size>". if set, pipes send stream through "mbuffer -m <size>"
2017-06-08 12:35:22 +02:00
Axel Burri
7436d9432c
change version to 0.25.0
2017-03-18 16:53:07 +01:00
Axel Burri
d31ffb8cb0
btrbk: allow trailing comments in btrbk.conf
2017-03-18 16:34:53 +01:00
Axel Burri
358a2b1169
btrbk: cleanup: btrfs_send_to_file() takes no more additional options (all info is fetched directly from source/target config)
2017-03-18 15:06:48 +01:00
Axel Burri
28c65e4675
btrbk: add raw_target_split option, using "split" instead of "dd" to write raw files
2017-03-18 14:47:43 +01:00
Axel Burri
3b7ede773a
btrbk: bugfix: make sure rate limiting comes after compression in cmd_pipe
2017-03-18 12:18:47 +01:00
Axel Burri
cb82bd5fa4
btrbk: add supoort for "backend btrfs-progs-sudo" option; adaptions in ssh_filter_btrbk.sh
2017-01-04 15:04:22 +01:00
Ian Kelling
d02f67a924
btrbk: get_receive_targets: also match "src.received_uuid == target.uuid"
...
This gets important when using an old backup disk as source.
In terms of btrfs send/receive, all subvolumes matching "uuid /
received_uuid" are valid backups.
Merged (amend) from pull request: #116
Verified by Axel Burri <axel@tty0.ch>
2017-01-04 12:41:05 +01:00
Axel Burri
79637de5aa
btrbk: raw_target_encrypt: always set "gpg --no-random-seed-file": prevents creation of "~/.gnupg/random_seed" with slight perfomance penalty.
...
We set "--no-random-seed-file" because one of the btrbk
design principles is to not create any files unasked. Enabling
"--no-random-seed-file" creates ~/.gnupg/random_seed, and as
such depends on $HOME to be set correctly (think on running in
cron). From gpg2(1) man page:
--no-random-seed-file GnuPG uses a file to store its
internal random pool over invocations This makes random
generation faster; however sometimes write operations are not
desired. This option can be used to achieve that with the cost
of slower random generation.
2017-01-03 13:41:39 +01:00
Axel Burri
b69e9ebf34
btrbk: show aggregate "size" and "used" for "usage" action
2016-12-11 15:36:48 +01:00
Axel Burri
da849b37ae
change version to 0.24.0
2016-11-16 15:32:17 +01:00
Axel Burri
ec63e9932b
btrbk: support for btrfs-progs v4.8.3
...
Fix parsing of "btrfs sub show" output, which has changed for toplevel
subvolume.
2016-11-16 15:02:49 +01:00
Axel Burri
57be688f6b
btrbk: bugfix: fix "list latest" with no snapshots
2016-11-12 13:21:33 +01:00
Axel Burri
a8a311c8c7
btrbk: add "backend" configuration option: support for distinct binaries from btrfs-progs-btrbk
...
btrfs-progs-btrbk sources (fork of btrfs-progs) can be found at:
https://github.com/digint/btrfs-progs-btrbk
2016-08-29 18:40:42 +02:00
Axel Burri
dc5dee3121
btrbk: use loglevel trace (instead of debug) for repeated WARN_ONCE
2016-08-29 15:03:56 +02:00
Axel Burri
1aa208151b
btrbk: improve check_file(): sanitize only on demand
2016-08-29 15:03:20 +02:00
Axel Burri
4c4afe776d
btrbk: skip target metadata test if send/receive has errors
2016-08-29 15:03:11 +02:00
Axel Burri
961f96833a
btrbk: use "dd" for raw target output, with configurable block size (raw_target_block_size)
...
We use "dd" instead of shell redirections, as it is common to have
special filesystems (like NFS, SMB, FUSE) mounted on the raw target
path. By using "dd" we make sure to write in reasonably large blocks
(default=128K), which is not always the case when using redirections
(e.g. "gpg > outfile" writes in 8K blocks).
Another approach would be to always pipe through "cat", which uses
st_blksize from fstat(2) (with a minimum of 128K) to determine the
block size.
2016-08-25 13:14:01 +02:00
Axel Burri
3dabb507e6
btrbk: do not set "--compress-algo none" on gpg command if raw_target_compress=no
...
Note that gpg might still compress (according to OpenPGP standard) if
--compress-algo is not set. This is generally a good thing.
2016-08-25 12:53:12 +02:00
Axel Burri
b0feaf4413
btrbk: force disabling of ssh compression (ssh -o compression=no) if stream_compress is set
2016-08-25 12:53:12 +02:00
Axel Burri
b49ee61ecd
btrbk: run_cmd: cosmetics
2016-08-25 12:53:12 +02:00
Axel Burri
5f530e47e5
btrbk: run_cmd: only perform sanity checks on files (hardcoded parts are considered safe)
2016-08-25 12:53:06 +02:00
Axel Burri
96f0d4c175
btrbk: fix and cleanup stream compression
2016-08-24 15:25:48 +02:00
Axel Burri
13d27c8616
btrbk: perform extra metadata check on target subvolume after "btrfs receive"
...
Eliminates error cases where "btrfs receive" input is null, at the
cost of an additional call to "btrfs subvolume show".
2016-08-19 17:41:03 +02:00
Axel Burri
deeb12c069
ssh_filter_btrbk: allow stream compression if --compress option is set.
2016-08-19 17:36:40 +02:00
Axel Burri
13887837b1
btrbk: add lz4 compression
2016-08-19 16:58:53 +02:00
Axel Burri
3845fa5ec5
btrbk: use format from %compression hash in $raw_postfix_match
2016-08-19 16:58:53 +02:00
Axel Burri
05c54a2390
btrbk: add compression options: pigz, pbzip2, lzo
2016-08-19 16:58:53 +02:00
Axel Burri
a019d8a3e3
btrbk: add configuration option "stream_compress"
...
- add sophisticated stream compression in run_cmd
- add special "compress" cmd_pipe item
- add special "redirect" cmd_pipe item:
use shell redirection instead of troublesome "dd of=".
- disable ssh_compression if stream_compression is set
2016-08-19 16:56:38 +02:00
Axel Burri
99ff88f82a
btrbk: use (and propagate) CONFIG in vinfo instead of hard-setting RSH
2016-08-19 16:54:49 +02:00
Axel Burri
079b947cd6
btrbk: add function WARN_ONCE
2016-08-19 16:48:45 +02:00
Tobias Grosser
84a5c56a83
btrbk: disable compression in gpg
...
We already perform compression before gpg, such that compressing in gpg
is just a waste of time. Interestingly, it seems gpg is not trying to
recompress gzip[ed] input streams, as for the default gzip compression
this patch does not change performance. However, it is necessary for
the upcoming lz4 compression to show its real benefit.
2016-08-07 13:40:45 +02:00
Axel Burri
9a5e8311be
change version to 0.23.3
2016-07-14 01:41:45 +02:00
Axel Burri
796b6bd9bf
btrbk: replace "realpath -e" with "readlink -e" for mountpoint discovery
2016-06-18 13:04:43 +02:00
Axel Burri
91d02ca97b
change version to 0.23.2
2016-06-07 16:41:41 +02:00
Axel Burri
e4a7ba4be5
btrbk: add lockfile support, using perl "flock": add configuration option "lockfile <file>", and command line option "--lockfile"'
2016-06-07 16:17:02 +02:00
Axel Burri
7326b9816c
btrbk: bugfix: raw targets: correctly handle multiple backups in same target directory
2016-05-09 12:42:04 +02:00
Axel Burri
cb0851c8b6
change version to 0.23.1
2016-05-03 16:21:34 +02:00
Axel Burri
5cd03a8fbf
btrbk: remove absolute path to executables, this caused trouble on some distros
2016-05-03 14:34:04 +02:00
Axel Burri
54b5368309
btrbk: code cleanup (remove unneeded code, rename vars)
2016-05-03 13:19:42 +02:00
Axel Burri
12d435d42a
btrbk: explain "orphaned" status in "stats" command, and suppress it on "list backups" command
2016-04-30 13:01:12 +02:00
Axel Burri
46f1e5e2e4
btrbk: only load Data::Dumper if needed (log level "trace", or development version); cosmetics
2016-04-28 13:03:15 +02:00
Axel Burri
49ae46d51d
btrbk: do not print headers to transaction_log, these are documented in btrbk.conf(5)
2016-04-28 12:51:00 +02:00
Axel Burri
e9e398af37
Merge branch 'syslog'
2016-04-28 12:45:13 +02:00
Axel Burri
7e7c28f8f1
btrbk: add eval_quiet(), a simple wrapper around eval, disabling $SIG_(__DIE__)
2016-04-28 12:43:32 +02:00
Axel Burri
082754173c
btrbk: bugfix: raw targets: do not inject child if add_btrbk_filename_info() failed
2016-04-25 21:12:33 +02:00
Axel Burri
47eb14f5fb
btrbk: syslog: add syslog hack in print_formatted(); remove print-to-scalar hack
2016-04-25 19:40:11 +02:00
Axel Burri
c424d917b6
btrbk: syslog: only load Sys::Syslog module if configuration option is set; soft-fail on syslog calls
2016-04-25 18:36:54 +02:00
Hans van Kranenburg
59d96420c8
btrbk: add transaction logging to syslog
...
Add configuration option transaction_syslog, which can be set to a short
name of a syslog facility, like user or local5. Most of the ones besides
localX do not really make sense, but whatever, let the user decide.
The only logging that is relevant for logging to syslog is the logging
generated inside sub action, so it's easy to hijack all messages in
there and also send them to syslog if needed.
All output is done via print_formatted, which expects a file handle.
So, abuse a file handle to a string to be able to change as less code as
needed for this feature.
Since syslog already adds the timestamps for us, I added a syslog
formatting pattern, which is very similar to tlog, omitting the
timestap.
2016-04-25 17:32:08 +02:00
Axel Burri
89df601ee5
btrbk: allow "<hostname>:<path>" notation for volume and target sections
2016-04-25 16:34:52 +02:00
Axel Burri
702ee8950e
btrbk: bugfix: vinfo(): correctly parse url, using check_url()
2016-04-25 15:10:00 +02:00
Axel Burri
357b72bd3f
btrbk: code cleanup: check_file() and check_url() do all the sanitize parts
2016-04-25 14:23:15 +02:00
Axel Burri
191284cd43
btrbk: bugfix: set correct parent section when propagating targets
2016-04-24 15:59:17 +02:00
Axel Burri
4ffaf430c5
change version to 0.23.0
2016-04-23 15:06:57 +02:00
Axel Burri
2e8e4ddefc
btrbk: cosmetics: change info log of send/receive; change topic line; fix typos
2016-04-23 14:58:08 +02:00
Axel Burri
efc260ef91
btrbk: add sanity check on timezone offset; add documentation about implications of long-iso time format
2016-04-23 14:49:12 +02:00
Axel Burri
c7dd680537
btrbk: make sure that snapshots/backups with date in the future are never deleted
2016-04-22 20:51:31 +02:00
Axel Burri
ecb2307b22
btrbk: send/receive: only inject child if target creation was successful
2016-04-22 20:25:30 +02:00
Axel Burri
3ffa63daba
btrbk: bugfix: btrfs_subvolume_show(): quote real_path everywhere
2016-04-22 20:17:26 +02:00
Axel Burri
c13c99ada5
btrbk: add new time_format "long-iso", with seconds and timezone offset (iso8601 format); add function timestamp(): remove dependency to POSIX
2016-04-22 19:47:01 +02:00
Axel Burri
e824c21f50
btrbk: use build-in Time::Local in combination with localtime() instead of Date::Calc; correctly calculate leap hours
2016-04-20 22:45:11 +02:00
Axel Burri
c73dffbd25
btrbk: handle missing Data::Dumper gracefully
2016-04-19 22:12:08 +02:00
Axel Burri
829490f963
btrbk: put btrbk filename info directly to tree node (parse only once)
...
performance win: factor 2.3
2016-04-19 22:04:07 +02:00
Axel Burri
c225231742
btrbk: reuse subvol list for get_receive_targets()
...
performance win: factor 2.6 !
2016-04-19 22:01:23 +02:00
Axel Burri
2b22524ccd
btrbk: sane defaults: xxx_preserve_min defaults to "all", xxx_preserve default to "no" (for backwards compatibility with 0.22.0 default)
2016-04-19 21:37:04 +02:00
Axel Burri
29b9c8fc60
btrbk: action "archive": abort if receive targets of archive candidates exist at unexpected location. makes sure we dont have duplicates on our archives
2016-04-19 21:02:51 +02:00
Axel Burri
5e7a6e5ef4
btrbk: action "archive": delete archives according to archive retention policy
2016-04-19 21:02:51 +02:00
Axel Burri
31f0f97ff0
btrbk: fix info logging for send/receive
2016-04-19 21:02:51 +02:00
Axel Burri
7807fface8
btrbk: cosmetics; s/config_override_opts/config_override_cmdline/g
2016-04-19 21:02:51 +02:00
Axel Burri
2c3997ad0a
btrbk: bugfix: action "config print": correctly handle undef options; skip deprecated options
2016-04-19 21:02:47 +02:00
Axel Burri
a27f99af46
change version to 0.23.0-rc1
2016-04-17 21:46:56 +02:00
Axel Burri
bbb18f5af7
btrbk: cosmetics on info warnings
2016-04-17 21:46:53 +02:00
Axel Burri
edfebb8193
btrbk: action "origin": use --format options; do not recurse into parent chain
2016-04-16 22:05:26 +02:00
Axel Burri
1151d2c572
btrbk: print_formatted(): honor use_header argument for all table formats
2016-04-16 20:25:22 +02:00
Axel Burri
9afe17f738
btrbk: continue gracefully (skip instead of abort) when resuming subvolume having existing (possibly garbled) target; cosmetics on debug/trace log
2016-04-16 19:31:29 +02:00
Axel Burri
ec9dd761b8
btrbk: use "[subvol cmd]" instead of "[btrfs cmd]", and print this as info log
2016-04-16 18:06:55 +02:00
Axel Burri
689d3d1233
btrbk: action "archive": print created subdirectories on summary; cleanup
2016-04-16 17:31:14 +02:00
Axel Burri
5a06a85619
btrbk: moved get_receive_targets_fsroot() out of get_receive_targets(), while cleaning up
2016-04-16 17:25:53 +02:00
Axel Burri
774e6ef842
btrbk: macro_archive_target(): only warn on unexpected targets, not abort
2016-04-16 17:25:53 +02:00
Axel Burri
de05b99757
btrbk: rename action "clone" to "archive" (should have been like this from the beginning)
2016-04-16 17:25:51 +02:00
Axel Burri
4bd68a2e35
btrbk: action "clone": abort all as soon as one target aborts
2016-04-16 00:45:16 +02:00
Axel Burri
cc20dfb8c3
btrbk: schedule(): use "informative_only" option instead of checking for empty value; make sure real values are always in front
2016-04-15 23:29:47 +02:00
Axel Burri
d0cfba7914
btrbk: action "clone": create missing directories
2016-04-15 23:29:47 +02:00
Axel Burri
a5c7c53a86
btrbk: action "clone": print scheduler results if --print-schedule option is set
2016-04-15 23:29:47 +02:00
Axel Burri
14de16aabe
btrbk: add action "clone": recursively send/receive all backups to an archive directory
2016-04-15 23:29:47 +02:00
Axel Burri
3c9aff4c40
btrbk: enable --override option
2016-04-15 11:10:12 +02:00
Axel Burri
e3702305e6
btrbk: bugfix: update uuid_cache after btrfs_subvolume_show()
2016-04-15 11:07:26 +02:00
Axel Burri
6e997674fc
btrbk: remove "btrfs_progs_compat" configuration option, from now on we REQUIRE btrfs-progs >= v3.18.2: we rely on received_uuid for most operations
2016-04-15 11:07:16 +02:00
Axel Burri
6aa54b2dd5
btrbk: bugfix: correctly handle NODE_SUBDIR in vinfo_inject_child()
2016-04-14 18:24:11 +02:00
Axel Burri
141b70f26b
btrbk: bugfix for subdir resolving: on older kernels, the "subvolid" mount option is not shown: try to read it with btrfs_subvolume_show()
2016-04-14 18:21:00 +02:00
Axel Burri
a1ee9d5c6d
btrbk: allow "{snapshot,target}_preserve no": disable retention policy
2016-04-14 14:43:43 +02:00
Axel Burri
a03c515b0a
btrbk: enter failsafe mode on deprecated preserve configuration: at least create the snapshots, and print message to read the upgrade documentation
2016-04-14 13:41:53 +02:00
Axel Burri
7c0987bd3c
btrbk: be harsh (abort) on deprecated "{snapshot,target}_preserve_{daily,weekly,monthly}" and "resume_missing no" options; change default of snapshot_preserve_min to one day
2016-04-13 22:05:20 +02:00
Axel Burri
36cc96fdb8
btrbk: always preserve latest snapshot/backup pair (instead of latest snapshot and latest backup); remove preserve_latest option of schedule()
2016-04-13 22:05:20 +02:00
Axel Burri
032642751b
btrbk: change preserve table text: print latest match instead of earliest match
2016-04-13 22:05:20 +02:00
Axel Burri
e200975f32
btrbk: add option "*preserve_min latest"; deny "snapshot_preserve_min no"
2016-04-13 22:05:20 +02:00
Axel Burri
d143d75b43
btrbk: rename *preserve_all to *preserve_min
2016-04-13 22:05:20 +02:00
Axel Burri
55b121c372
btrbk: remove resume_missing configuration option
2016-04-13 22:05:20 +02:00
Axel Burri
738178565c
btrbk: fix vinfo_inject_child() for raw targets
2016-04-13 22:05:20 +02:00
Axel Burri
a76512955a
btrbk: add vinfo_inject_child(): add a custom node to btr_tree, with fake id, uuid, gen and cgen; use to inject created snapshots and receive targets
2016-04-13 17:17:23 +02:00
Axel Burri
bd34d9f689
btrbk: change preserve logic: keep FIRST present of hour/day/... instead of LAST
2016-04-13 17:17:14 +02:00
Axel Burri
7a334097c1
btrbk: cosmetics (logging and summary text about -p option)
2016-04-12 11:47:41 +02:00
Axel Burri
326edfcc29
btrbk: change preserve semantics (incompatible):
...
- add "{snapshot,target}_preserve_all" configuration option
- change semantics of "{snapshot,target}_preserve NNd" to "preserve
latest daily only"
- change default of "preserve daily,monthly" to 0 (was: all)
- add deprecated warning and enter compatibility mode: preserve
everything if deprecated {snapshot,target}_preserve_* options are
encountered
2016-04-12 11:47:28 +02:00
Axel Burri
ceb4dbf19c
btrbk: add --print-schedule command line option
2016-04-09 14:16:14 +02:00
Axel Burri
78bfc5b885
btrbk: bugfix: use "/bin/false" as RSH if no config is available
2016-04-08 13:38:50 +02:00
Axel Burri
a887e89732
btrbk: warn on receive targets at unexpected location (whole filesystem) when resuming missing backups (do not abort anymore);
2016-04-07 14:35:27 +02:00
Axel Burri
6b71b68fcb
btrbk: bugfix: do not run "rm" command with no arguments (on raw targets)
2016-04-06 20:41:36 +02:00
Axel Burri
5d65748ffe
btrbk: call init_transaction_log() at the beginning of every action, instead at global place
2016-04-06 20:27:27 +02:00
Axel Burri
211964f709
btrbk: parse btrbk_basename and btrbk_date in vinfo_child() instead of vinfo_subvol_list()
2016-04-06 20:24:56 +02:00
Axel Burri
bfb556757d
btrbk: get_latest_common(): use all brothers (snapshots with same parent) as candidates (older first, then newer) instead of only older; as last resort, use subvolumes in snapshot_dir matching btrbk file name scheme as candidates
2016-04-06 15:36:54 +02:00
Axel Burri
46e3aae857
btrbk: get_latest_common(): add strategy to find latest common for readonly and received subvolumes; add helper function cmp_date()
2016-04-06 15:36:51 +02:00
Axel Burri
a26e8851b4
btrbk: btr_tree: return already assembled tree if a subvolume is already known in uuid_cache
2016-04-06 15:36:27 +02:00
Axel Burri
ac0002bce8
btrbk: get_receive_targets() also returns matching source_received_uuid
2016-04-06 15:36:27 +02:00
Axel Burri
4b1983378f
btrbk: add useful flags and parse date and basename of btrbk created files in vinfo_subvol_list(); replace parse_filename() calls by usage of new flags
2016-04-06 13:35:37 +02:00
Axel Burri
0bfb78b842
btrbk: remove trailing slash from NODE_SUBDIR
2016-04-03 21:41:41 +02:00
Axel Burri
899ca92026
btrbk: bugfix: untaint raw backup file list read by "find" command
2016-04-03 21:38:19 +02:00
Axel Burri
023004e9cc
btrbk: bugfix: add '=' character to (regression introduced in a7cd4a99
)
2016-04-03 21:09:30 +02:00
Axel Burri
ea5cd06fbc
btrbk: bugfix: get_receive_targets() for BTRFS_PROGS_COMPAT (regression introduced in 207e8868
)
2016-04-03 21:09:30 +02:00
Axel Burri
302400d640
btrbk: bugfix: disallow snapshot_preserve_* in target section
2016-04-03 15:13:16 +02:00
Axel Burri
a7cd4a994c
btrbk: add some extra safety when running shell commands
2016-04-02 14:13:16 +02:00
Axel Burri
86170e6b21
btrbk: bugfix: untaint result of system_realpath()
2016-04-02 14:10:35 +02:00
Axel Burri
79caba4267
btrbk: rename %symlink -> %realpath_cache (returning real_path instead of real_url)
2016-03-31 17:24:24 +02:00
Axel Burri
7ee5778dee
btrbk: bugfix: print correct target on "same backup target error"
2016-03-31 17:24:24 +02:00
Axel Burri
c4073f6c53
btrbk: print target_path instead of target_subvol for "list {target,config}"
2016-03-31 17:24:24 +02:00
Axel Burri
3ada7c174e
btrbk: allow targets to be directories (use mountpoint framework)
2016-03-31 17:24:24 +02:00
Axel Burri
06043cf800
btrbk: add btrfs mountpoint resolving functionality
2016-03-31 17:24:23 +02:00
Axel Burri
de96f267b8
btrbk: propagate target sections to (sub-)subsections (allow target sections everywhere in the config)
2016-03-31 17:24:18 +02:00
Axel Burri
f9ca7504c8
btrbk: add configuration option "rate_limit" (using pv -L)
...
Original patch provided by @janpascal: "Jan-Pascal van Best"
2016-03-23 11:58:35 +01:00
Axel Burri
e6d46e8a02
btrbk: fix regression: correctly handle previously received subvolumes in get_latest_common()
...
regression from: 8819c67502
2016-03-22 19:30:21 +01:00
Axel Burri
7bb18050f8
btrbk: detect interrupted transfers of raw targets; delete incomplete raw targets on action "clean"
2016-03-22 19:28:05 +01:00
Axel Burri
c2b11775a0
btrbk: cosmetics: adapt debug/trace messages
2016-03-16 19:21:48 +01:00
Axel Burri
1adb318f02
documentation: cosmetics: change all url from www.digint.ch to digint.ch
2016-03-16 18:34:28 +01:00
Axel Burri
247f023bab
btrbk: allow wildcards in subvolume section; add option "wildcards" in check_file()
2016-03-16 18:17:44 +01:00
Axel Burri
b9fa3e6e90
btrbk: add init_config(); use default config in action "diff"; use root config context for action "origin"
2016-03-15 16:54:54 +01:00
Axel Burri
8819c67502
btrbk: fixed raw targets
2016-03-15 14:53:51 +01:00
Axel Burri
e9bc4950ac
btrbk: re-ordering of functions (no functional changes)
2016-03-15 11:21:59 +01:00
Axel Burri
207e8868da
btrbk: no more copy of node information in vinfo by vinfo_set_detail(); always use vinfo->{node}{key}; cleanup
2016-03-14 20:21:12 +01:00
Axel Burri
9a68ab6519
btrbk: use symlink hash instead of REAL_URL
2016-03-14 15:56:20 +01:00
Axel Burri
cab2a88843
btrbk: move url_cache lookup to vinfo_subvol_list
2016-03-14 12:59:24 +01:00
Axel Burri
14d1ca1976
btrbk: add warning if a receive target of resume candidate exists at unexpected location
2016-03-12 19:16:07 +01:00
Axel Burri
1b45db3c59
btrbk: simplify btr_tree: SUBTREE is now list instead of hash; add TREE_ROOT pointer to every node; cleanup
2016-03-11 14:55:22 +01:00
Axel Burri
97caced09d
btrbk: rename %btrfs_tree_cache -> %url_cache, %uuid_info -> %uuid_cache; cleanup
2016-03-10 22:21:55 +01:00
Axel Burri
84820933ed
btrbk: remove %uuid_url_map (replace by get_cached_url_by_uuid() operating on %btrfs_tree_cache)
2016-03-10 22:21:55 +01:00
Axel Burri
743d7704f5
btrbk: correctly fill cache; fix vinfo_set_detail; add debug functionality (VINFO(), SUBTREE_LIST()); cleanup
2016-03-10 22:21:55 +01:00
Axel Burri
e85b6dadf1
btrbk: data structure refactoring:
...
- remove %subvol_list_cache: may slow down aa bit, but makes possible
to inject nodes correctly
- simplify subtree list (is now an array as it should have been from
the beginning); correctly fill tree_cache
- fix vinfo_set_detail; cleanup
2016-03-10 22:19:36 +01:00
Axel Burri
1d054bf04a
btrbk: refactoring of add global caches: reduce btrfs-progs calls, and make sure all root vinfo (especially targets) with same URL share the same SUBVOL_LIST reference.
...
- %btrfs_tree_cache (replaces %root_tree_cache)
- %subvol_list_cache (replaces %vinfo_cache):
- vinfo_init_root() (was: vinfo_root()) now lookups in cache before
calling btrfs_subvolume_detail()
- vinfo_subvol_list() now lookups in cache before calling
btrfs_subvolume_list()
2016-03-09 19:52:45 +01:00
Axel Burri
ba90c13320
btrbk: fixed schedule() debug text
2016-03-08 18:22:58 +01:00
Axel Burri
c1b27c744b
btrbk: clone target subvolume tree if same url as other target (less btrfs calls, shared SUBVOL_LIST)
2016-03-08 16:41:02 +01:00
Axel Burri
eba08f2ca3
btrbk: add config_preserve_hash(); fix macro_delete()
2016-03-08 15:31:16 +01:00
Axel Burri
5cc908313a
btrbk: cleanup trace output; cosmetics
2016-03-08 15:31:08 +01:00
Axel Burri
f770488d85
btrbk: adapt all actions to use vinfo_subsection()
2016-03-07 22:54:27 +01:00
Axel Burri
fbbd82114d
btrbk: move SUBVOL_RECEIVED, SUBVOL_DELETED, SNAPSHOT_CREATED, SNAPSHOT_UP_TO_DATE data from config to corresponding vinfo
2016-03-07 21:45:12 +01:00
Axel Burri
6f1e94eb27
btrbk: adapt action "run" to use vinfo_subsection()
2016-03-07 20:47:24 +01:00
Axel Burri
b2be1357eb
btrbk: fixed vinfo_set_detail(), while being very paranoid; fixed vinfo_subsection (was: valid_subsection_vinfo); adaptions in vinfo readin (working again)
2016-03-07 20:30:06 +01:00
Axel Burri
ab4ded9830
btrbk: ABORTED() now sets $abrt to last message (useful for warnings after abort)
2016-03-07 20:29:57 +01:00
Axel Burri
96faae9659
btrbk: be harsh, remove sroot, droot, svol in config (will break a lot of things!)
2016-03-07 19:15:57 +01:00
Axel Burri
d3148851c5
btrbk: first adaptions for vinfo holding config
2016-03-07 17:36:02 +01:00
Axel Burri
ceb346db66
btrbk: skeleton for vinfo holding config
2016-03-07 17:35:17 +01:00
Axel Burri
5030d54318
btrbk: split "check for duplicate snapshot locations" from "fill vinfo hash"
2016-03-07 15:33:37 +01:00
Axel Burri
46bd1ad52a
btrbk: add function macro_delete(), used by snapshot/backup delete
2016-03-02 00:04:24 +01:00
Axel Burri
e806d4812f
btrbk: cosmetics: adapt debug text and variable names for macro_send_receive() and similar
2016-03-01 21:55:09 +01:00
Axel Burri
6c9643f2be
btrbk: action "diff": print total size
2016-03-01 21:52:06 +01:00
Axel Burri
a1124053a7
btrbk: bugfix: sort numerically (low prio, affects only list output)
2016-03-01 19:31:43 +01:00
Axel Burri
ac1b7271c4
btrbk: read readonly flag in btrfs_subvolume_list(). this requires an additional call to btrfs-progs.
2016-03-01 15:10:37 +01:00
Axel Burri
9eb38ac9d0
btrbk: add {snapshot,target}_preserve shortcut
2016-03-01 12:30:35 +01:00
Axel Burri
4aa4be3942
btrbk: different (correct) text output for scheduler results
2016-03-01 11:40:27 +01:00
Axel Burri
a049d18b90
btrbk: implement {snapshot,target}_preserve_yearly
2016-03-01 11:40:20 +01:00
Axel Burri
4434bc17ef
changed version to 0.22.2
2016-02-02 11:26:09 +01:00
Axel Burri
e913b23e99
btrbk: fixed debug/trace output of btrfs_filesystem_usage()
2016-02-01 17:07:17 +01:00
Axel Burri
6f66f72c26
btrbk: bugfix: fix checks on "btrfs sub show" output, which resulted in breakage on btrfs-progs < 4.1
2016-02-01 17:05:12 +01:00
Axel Burri
d3990bcc90
btrbk: increment copyright year
2016-01-21 17:41:40 +01:00
Axel Burri
872779398e
changed version to 0.22.1
2016-01-20 18:47:29 +01:00
Axel Burri
13a656a6d4
btrbk: add more sophisticated checks for possible future incompatibilities of btrfs-progs
2016-01-20 18:22:08 +01:00
Axel Burri
7a4aa4b650
btrbk: add support for btrfs-progs v4.4
2016-01-20 17:53:36 +01:00
Axel Burri
9595adc2a5
changed version to 0.22.0
2016-01-19 21:08:19 +01:00
Michael Düll
14c5c41e72
btrbk: make pv more useful by passing parameters.
...
Disabling the non-functional progress bar and
adding average and written byte counters.
Signed-off-by: Michael Düll <michael.duell@rub.de>
Remove -e option (-trab instead of -traeb).
Also add same options to btrfs_send_to_file().
Signed-off-by: Axel Burri <axel@tty0.ch>
2016-01-19 18:01:24 +01:00
Axel Burri
614438183f
btrbk: bugfix: run_cmd: do not redirect all stderr output, as this kills progress-viewer (pv) output
2016-01-19 17:52:27 +01:00
Axel Burri
a1698ef4b0
btrbk: print "$hostname:$path" instead of "{$hostname}$path" in summary and logs
2016-01-17 19:44:59 +01:00
Axel Burri
8a29ced0c9
btrbk: add up-to-date flag to stats; print "target/snapthot_name.*" instead of just "target" in stats
2016-01-17 18:56:14 +01:00
Axel Burri
5a4f4744c9
btrbk: cosmetics (remove obsolete line of code)
2016-01-15 02:30:42 +01:00
Axel Burri
e7ff20114c
btrbk: add "stats" action (print snapshot/backup statistics)
2016-01-15 02:06:03 +01:00
Axel Burri
a82c1f533a
btrbk: added configuration options "raw_target_compress_level", "raw_target_compress_threads"
2016-01-14 18:02:53 +01:00
Axel Burri
3461f9440b
btrbk: bugfix: allow filter for action "clean"
2016-01-14 16:39:43 +01:00
Axel Burri
9718ad1460
btrbk: add "-n, --dry-run" option
2016-01-14 16:11:33 +01:00
Axel Burri
3624a8fba0
btrbk: add "clean" action (delete incomplete, garbled backups)
2016-01-14 16:11:30 +01:00
Axel Burri
3a1610622d
btrbk: bugfix
2016-01-14 15:03:55 +01:00
Axel Burri
51ddb20232
btrbk: set status=incomplete in "btrbk list backups" if received_uuid is not set but target subvolume matches our naming
2016-01-13 15:32:22 +01:00
Axel Burri
33c19e622a
btrbk: bugfix: fix monthly schedule if older than 10 weeks
2015-12-17 19:00:45 +01:00
Nicolas Porcel
3b740948fb
btrbk: bugfix: config option "timestamp_format long": correct number of arguments for sprintf (breaks when using perl v5.22.0)
2015-12-15 12:49:34 +01:00
Axel Burri
cb01507bb1
changed version to 0.21.0
2015-10-25 12:29:52 +01:00
Axel Burri
612b9fda6c
btrbk: check files for directory traversal; cosmetics
2015-10-25 12:20:59 +01:00
Axel Burri
e732b92dd5
btrbk: always preserve all raw targets (as long as incremental rotation is not implemented)
2015-10-23 19:12:37 +02:00
Axel Burri
1360e059a4
btrbk: construct a (fake) uuid for raw files, and set parent_uuid correctly (fixes "origin" command)
2015-10-23 19:12:37 +02:00
Axel Burri
ab356937d5
btrbk: add "--override=KEY=VALUE" command line option (disabled for now)
2015-10-23 19:12:37 +02:00
Axel Burri
daedfb88a2
btrbk: bugfix: correct $raw_postfix_match
2015-10-23 19:12:37 +02:00
Axel Burri
3f09d2c37f
btrbk/documentation: rename "resolve *" commands to "list *"; cleanup
2015-10-22 17:59:17 +02:00