Commit Graph

1109 Commits (sync-after-delete)

Author SHA1 Message Date
Axel Burri 5a2e89fc62
Merge pull request #425 from Nox996/sync-after-delete
On branch sync-after-delete
2021-11-06 16:30:16 +00:00
Christian Denk 6ff62cf2ba On branch sync-after-delete
Your branch is up to date with 'origin/sync-after-delete'.

 Changes to be committed:
	modified:   btrbk
	modified:   ssh_filter_btrbk.sh

btrbk:
- included the btrbk filesystem sync command for btrfs-progs-sudo
- inserted the btrbk filesystem sync command in between btrfs subvolume delete and btrfs subvolume sync in case "btrfs_commit_delete=sync"

Rationale:
The btrfs filesystem sync actually triggers the deletion of the subvolume right away. Therefore, btrfs subvolume sync does not wait so long.
2021-10-27 22:27:45 +02:00
Axel Burri f78fd742e4 WIP btrbk: add btrfs_commit_delete=sync 2021-10-24 11:07:08 +02:00
Axel Burri cb38b7efa4 btrbk: parse additional "btrfs subvolume show" lines from btrfs-progs-5.14.2 2021-10-24 10:39:16 +02:00
Axel Burri c538702d8c btrbk: abort on unexpected only if receive target is not present 2021-10-04 19:17:36 +02:00
Axel Burri 4234fb2965 btrbk-verify: cleanup 2021-09-04 17:15:56 +02:00
Axel Burri d554afab10 btrbk-verify: allow ssh-user without ssh-identity
Required e.g. if a ssh-agent is already running, and we want to set
user=root for rsync.
2021-09-04 16:57:05 +02:00
Axel Burri bef13275d3 btrbk: fix regression: print quoted rsh command in table output
regression from: 27388c7589 btrbk: treat all filenames as unsafe
2021-09-04 15:46:57 +02:00
Axel Burri 1bda5fd978 btrbk: tidy safe_cmd; die if quoting leading dash for command
This should never happen, as all our filenames are checked to be
absolute.
2021-09-04 15:46:09 +02:00
Axel Burri d1247359f8 btrbk: always return abort key 2021-08-28 14:49:12 +02:00
Axel Burri faec607d02 btrbk: drop deprecated -r,--resume-only argument
Deprecated as of btrbk v0.26.0 (more than 3 years ago).
2021-08-28 14:06:10 +02:00
Axel Burri 3f84345bed btrbk: tidy logging 2021-08-28 14:06:10 +02:00
Axel Burri 5dc2375a75 btrbk: fix raw file deletion 2021-08-28 14:06:10 +02:00
Axel Burri 424127441d btrbk: fix unsafe path for btrfs send to file 2021-08-28 14:06:10 +02:00
Axel Burri fe53198661 btrbk: drop support for deprecated raw format
Raw backups created by btrbk < 0.26.0 are now ignored:

   *.btrfs_<received_uuid>[@<parent_uuid>][.gz|bz2|xz][.gpg][.split][.part]
2021-08-28 14:06:02 +02:00
Axel Burri d7653a9e0a documentation: add incremental_prefs; adapt incremental_clones 2021-08-27 17:20:47 +02:00
Axel Burri 85c2d14287 btrbk: change incremental_prefs defaults
New defaults gives the btrbk_direct_leaf snapshots higher preference
than the global ones resolved by parent-uuid (which are best-guess).

This way the parent has a higher chance of being a backup created by
btrbk, which results in "btrfs receive" to start work on a snapshot of
this (and preferably not on the "best-guess" ones).
2021-08-27 17:20:47 +02:00
Axel Burri bde0c10a6c btrbk: add incremental_prefs config option 2021-08-27 17:20:47 +02:00
Axel Burri 6ca00feeb6 btrbk: tidy parent selection
Preparatory for incremental_prefs feature, no functional changes.
2021-08-27 17:20:47 +02:00
Axel Burri 10a6f51730 btrbk: remove deprecation on incremental_clones
btrbk does not set config defaults to global scope for deprecated
keys.
2021-08-27 17:20:47 +02:00
Axel Burri 9f877a4670 btrbk: remove extra clone source, deprecate numeric incremental_clones 2021-08-27 17:20:47 +02:00
Axel Burri 1cb958ee30 btrbk: add "match" target for deprecated options 2021-08-27 17:20:39 +02:00
Axel Burri ad6298bf37 btrbk: add global split_match (cosmetics) 2021-08-19 17:16:50 +02:00
Axel Burri eb69bc883e btrbk: refactor mountinfo
- Create tree from /proc/self/mountinfo, and use it to find mount
  points.

- Populate realpath cache from mount points, possibly reducing calls
  to `realpath`.

- Replace btrfs_mountpoint with vinfo_mountpoint(fs_type => 'btrfs)

- Tidy action "ls".

- Move code
2021-08-18 13:14:10 +02:00
Axel Burri 063c25ad24 btrbk: add sanity checks on mountinfo list 2021-08-18 13:14:10 +02:00
Axel Burri 2556492ec6 documentation: btrbk.conf.5: remove paragraph on filename restrictions 2021-08-18 13:14:10 +02:00
Axel Burri 6a29b08f00 btrbk: remove filename restrictions 2021-08-18 13:14:10 +02:00
Axel Burri b8370de9de documentation: terminate options using double dash "--" 2021-08-18 13:14:10 +02:00
Axel Burri 4b7b7cfc06 documentation: btrbk.1: rephrase --format=raw 2021-08-18 02:08:28 +02:00
Axel Burri af5d25c5a9 btrbk-verify: expect single quotes from btrbk raw table output 2021-08-18 02:08:28 +02:00
Axel Burri 81a04e4287 btrbk: use single quotes for raw table format 2021-08-18 02:08:28 +02:00
Axel Burri 48bf4f05b9 btrbk: fix table output for utf8 characters (require Text::CharWidth)
Use Text::CharWidth::mbswidth() if installed, fallback to
length(Encode::decode_utf8()), fallback to length().

 - Text::CharWidth handles wide chars (e.g. asian, taking up two
   columns on the terminal) correctly.

 - length(Encode::decode_utf8()) handles single-width chars only, and
   should be installed on most systems (perl >= v5.7.3).

 - langth() counts bytes, as we do not convert anything to UTF-8 in
   btrbk (NOT using `perl -CIOEioA` or binmode(STDOUT, ":utf8"))
2021-08-18 02:08:28 +02:00
Axel Burri 94a415e420 btrbk: check/sanitize leading/trailing whitespace on files 2021-08-18 02:08:28 +02:00
Axel Burri 77a39282de ssh_filter_btrbk.sh: allow quoted files 2021-08-18 02:08:28 +02:00
Axel Burri f7d3823d5d ssh_filter_btrbk.sh: fix files are always absolute 2021-08-18 02:08:28 +02:00
Axel Burri 3e9b581a54 btrbk: add --unsafe-filenames option 2021-08-18 02:08:28 +02:00
Axel Burri 1a7bbff767 btrbk: tidy run_cmd calls 2021-08-18 02:08:28 +02:00
Axel Burri 27388c7589 btrbk: treat all filenames as unsafe 2021-08-18 02:08:28 +02:00
Axel Burri 2933e65cbe btrbk: adapt usage of unsafe arguments for run_cmd 2021-08-18 02:08:28 +02:00
Axel Burri acc7f9fc83 btrbk: quote unsafe characters in shell commands
As filenames can contain meta characters like '$', we can't just put
ssh commands in double quotes. E.g. the following would trigger
variable expansion on local shell:

    ssh example.com "ls -l 'evil$x'"

Instead, we quote the ssh using single quotes (adding the need to
escape single quotes), while also quoting unsafe filenames using
single quotes. The above becomes:

    ssh example.com 'ls -l '\''evil$x'\'''

Or more complex, for a file named "file with'single quotes'":

    ssh example.com 'ls -l '\''file with'\''\'\'''\''single quotes'\''\'\'''\'''\'''

On the remote shell, this will expand to:

    ls -l 'file with'\''single quotes'\'''
2021-08-18 02:08:28 +02:00
Axel Burri d7f6d5fecf btrbk: accept quoted values in config 2021-08-18 02:08:28 +02:00
Axel Burri 5d94de9142 btrbk: use File::Spec for relative file arguments 2021-08-18 02:08:28 +02:00
Axel Burri eccb24ecd7 btrbk: fix action "usage"
Regression from:

   b658fba08c btrbk: print snapdir and targets for action "usage"
2021-08-18 02:08:28 +02:00
Axel Burri 3cf69f3537 btrbk: add missing table ralign 2021-08-18 02:08:28 +02:00
Axel Burri 2f88d5ab4c btrbk: check for deleted subvol before panicking 2021-08-18 02:08:28 +02:00
Axel Burri 6e7c8c409b btrbk: cosmetics: fix trace log 2021-08-18 02:08:28 +02:00
Axel Burri 808633a3ae btrbk-verify: remove workarounds for old versions; tidy eval 2021-08-09 19:06:20 +02:00
Axel Burri d9958cbbc1 btrbk-verify: use new raw table format keys 2021-08-09 19:06:20 +02:00
Axel Burri 9278211123 btrbk: fix resolved ambiguity in raw table formats
rename snapshot_path -> snapshot_subvolume
rename target_path   -> target_subvolume

These point to subvolumes, not paths containing subvolumes.
2021-08-09 19:06:20 +02:00
Axel Burri 2347163780 btrbk: table formats: replace source_path with source_subvolume 2021-08-09 19:06:20 +02:00