Commit Graph

212 Commits

Author SHA1 Message Date
Marian Beermann a3ee9d2c5f borg recreate: Re-create existing archives.
Use with caution: permanent data loss by specifying incorrect patterns
is easily possible. Make a dry run to make sure you got everything right.

borg recreate has many uses:
- Can selectively remove files/dirs from old archives, e.g. to free
  space or purging picturarum biggus dickus from history
- Recompress data
- Rechunkify data, to have upgraded Attic / Borg 0.xx archives deduplicate
  with Borg 1.x archives. (Or to experiment with chunker-params for
  specific use cases

It is interrupt- and resumable.

Chunks are not freed on-the-fly.
Rationale:
  Makes only sense when rechunkifying, but logic on which new chunks to
  free what input chunks is complicated and *very* delicate.

Future TODOs:
- Refactor tests using py.test fixtures
  -- would require porting ArchiverTestCase to py.test: many changes,
     this changeset is already borderline too large.
- Possibly add a --target option to not replace the source archive
  -- with the target possibly in another Repo
     (better than "cp" due to full integrity checking, and deduplication
      at the target)
- Detect and skip (unless --always-recompress) already recompressed chunks

Fixes #787 #686 #630 #70 (and probably some I overlooked)
Also see #757 and #770
2016-04-10 13:54:44 +02:00
Marian Beermann 0a369c0985
Better help texts and Sphinx reproduction of usage
- Group options
- Nicer list of options in Sphinx
- Deduplicate 'Common options'
  (including --help)

The latter is done by explicitly declaring --help in the common_parser,
which is then inherited by the sub-parsers; no change in observable
behaviour.
2016-04-10 01:28:19 +02:00
Thomas Waldmann cece7f9e6d merged 1.0-maint into master 2016-04-10 01:13:35 +02:00
Lauri Niskanen 327c7219df Add archive comments
- Archives now have a new metadata field 'comment'
- 'info' command shows a comment if it's present
- 'create' command now has option '--comment' for adding comments to archives.
- A new command 'comment' is added for modifying the comments on existing
  archives.

Resolves #842.
2016-04-08 19:03:14 +03:00
TW a519333376 add --warning, --error, --critical for completeness, fixes #826
it's not recommended to suppress warnings or errors,
but the user may decide this on his own.

note: --warning is not given to borg serve so a <= 1.0.0 borg
will still work as server. it is not needed as it is the default.
2016-04-03 20:20:48 +02:00
TW d56e4c5370 Merge pull request #818 from borgbackup/1.0-maint
merge append-only from 1.0 maint
2016-03-31 20:28:49 +02:00
Marian Beermann 8f6ce9051b append-only mode: docs reformulated 2016-03-31 18:52:40 +02:00
Marian Beermann effa992d22 append-only mode: use single file for log, disallow check --repair, docs 2016-03-31 18:23:08 +02:00
Ed Blackman 2ab324c03f Add 'x' status for excluded paths (#814)
Makes it easy to see paths excluded by --exclude* options for testing of
regexes, and for ongoing monitoring that files desired for backup aren't
getting excluded accidentally.
2016-03-30 22:38:31 -04:00
Lauri Niskanen 1d3e69e4c7 Improve 'borg diff' output format
The main design goals of the new format:
 - One file takes exactly one line of output
 - The format is easy to read with typical, long list of changes
 - Metadata changes are visible and easy to examine
 - Unuseful information is not shown

Resolves #757.
2016-03-26 23:50:03 +02:00
Marian Beermann 0e9aea2660 Update borg diff example 2016-03-18 13:30:02 +01:00
Marian Beermann 89120a9843 Update usage docs 2016-03-18 12:17:57 +01:00
Daniel Reichelt e1f6a34820 provide wrapper for borg mount, fixes #743
- add archiver.main_mount()

- provide borgfs behaviour when the monolithic binary is called via a
  symlink called borgfs

- docs: update usage of mount subcommand, provide examples for borgfs and
  add symlink creation to standalone binary installation

- run build_usage

- add entry point in setup.py

- patch helpers.py:get_keys_dir() to allow mounting fstab entries with
  "user" option set

  Without this, setuid() called at some point by mount changes the HOME
  environment variable to '/root' and os.expanduser('~') would return
  '/root' as well, thus the mount would fail with
 	 PermissionError: [Errno 13] Permission denied: '/root/.config'
  After setuid(), the HOME variable stays intact, so we still can
  explicitly query USER's home.

  Also, os.path.expanduser() behaves differently for '~' and '~someuser'
  as parameters: when called with an explicit username, the possibly set
  environment variable HOME is no longer respected. So we have to check if
  it is set and only expand the user's home directory if HOME is unset.

- add myself to AUTHORS
2016-03-17 01:40:17 +01:00
Thomas Waldmann 95c4cf221d implement password roundtrip, fixes #695 2016-03-05 16:21:44 +01:00
Thomas Waldmann af2eaaabd4 update and improve docs
use the travis status image as png as svg does not show an image in firefox.
2016-02-27 17:22:56 +01:00
Teemu Toivanen a94471dc0e Usage examples for create format tags 2016-02-25 00:41:24 +02:00
Thomas Waldmann 08a7ce5cc3 Merge branch 'feature/list-formatting' of https://github.com/manwegit/borg into feature/list-formatting 2016-02-21 19:15:31 +01:00
Thomas Waldmann 347778b749 docs: add example how to restore a raw device
also: do not use /dev/sda in case someone stupidly tries out the examples.
/dev/sdx should be safe for people who do not understand what they do.
2016-02-18 21:38:31 +01:00
Thomas Waldmann 0b44944b47 docs: add examples for delete (and handle delete after list, before prune), fixes #656 2016-02-17 00:30:33 +01:00
jhemmje bf31fe3173 docs: Updated examples in usage.rst, fixes #644 2016-02-15 21:38:11 +01:00
Mark Lopez 2b8083bb20 Fixed typo. 2016-02-08 19:54:20 -06:00
Mark Lopez 99a3bab68d Added example to BORG_RSH documentation. 2016-02-07 22:07:30 -06:00
Thomas Waldmann 6c278e2e85 docs: formatting fixed 2016-02-07 19:33:26 +01:00
Teemu Toivanen 14f0fa6f6a archive file listing output formatting
Coding style fixup
Add --list-format exmaple to usage examples
2016-02-05 21:07:04 +02:00
Thomas Waldmann 0a0f483daa docs about borg serve's special support for forced/original ssh commands, fixes #544 2016-02-01 01:18:37 +01:00
Robin Schneider a7ed461394
Use `--one-file-system` instead of `--do-not-cross-mountpoints` in docs.
Related to #296 in which support for `--do-not-cross-mountpoints` has
been deprecated.
2016-01-31 11:54:01 +01:00
Thomas Waldmann e06b7162c2 update docs / docstring about new key location 2016-01-28 23:15:49 +01:00
Thomas Waldmann 824e548b9f add missing example for --list option of borg create 2016-01-28 20:32:30 +01:00
Thomas Waldmann 1fc99ec9cd update docs, remove references to passphrase mode 2016-01-24 16:04:00 +01:00
Thomas Waldmann b2dedee3c8 refactor yes(), cleanup env var semantics, fixes #355
refactorings:

- introduced concept of default answer:

if the answer string is in the defaultish sequence, the return value of yes() will be the default.
e.g. if just pressing <enter> when asked on the console or if an empty string or "default" is
in the environment variable for overriding.

if an environment var has an invalid value and no retries are enabled: return default
if retries are enabled, next retry won't use the env var again, but either ask via input().

- simplify:

only one default - this should be a SAFE default as it is used in some special conditions
like EOF or invalid input with retries disallowed.

no isatty() magic, the "yes" shell command exists, so we could receive input even if it is not from a tty.

- clean:

separate retry flag from retry_msg
2016-01-24 16:04:00 +01:00
Thomas Waldmann 169634f2ca change the builtin default for --chunker-params, create 2MiB chunks, fixes #343
one of the biggest issues with borg < 1.0 was that it had a default target chunk
size of 64kiB, thus it created a lot of chunks, a huge chunk management overhead
(high RAM and disk usage).
2016-01-24 15:44:09 +01:00
Thomas Waldmann a2843bc939 docs: require python 3.4+
remove references to older pythons.
2016-01-24 14:57:48 +01:00
Michael Hanselmann c7fb598ab9 Add shell-style pattern syntax
The fnmatch module in Python's standard library implements a pattern
format for paths which is similar to shell patterns. However, “*”
matches any character including path separators. This newly introduced
pattern syntax with the selector “sh” no longer matches the path
separator with “*”. Instead “**/” can be used to match zero or more
directory levels.
2016-01-21 16:07:24 +01:00
Piotr Pawlow 987aaa34df Added SSH key options to the usage example. 2016-01-18 18:49:07 +01:00
Robin Schneider 1f49d16a71
Fixed my changes. Thanks to @ThomasWaldmann for the review! 2016-01-18 09:00:07 +01:00
Robin Schneider 89ce86a33b
Fixed more in usage.rst. - → –; – → -- (CLI); Bullet list. 2016-01-17 22:23:54 +01:00
Robin Schneider 83c5321f53
Fixed RST warning markup. 2016-01-17 20:13:45 +01:00
Robin Schneider 19eb8e2d3b
Use ``--option`` in RST to not render "--" as "–". 2016-01-17 20:12:23 +01:00
Thomas Waldmann 2f05e4add9 use the usual commandline arguments order for borg prune examples, fixes #560
borg prune <options> <repo>
2016-01-16 20:57:22 +01:00
Danny Edel 6cedfbede9 Correct small typos in changes and usage 2016-01-15 09:24:00 +01:00
Thomas Waldmann 8ce84cab30 update docs / make them more clear about -v 2016-01-14 19:34:07 +01:00
Michael Hanselmann 2bafece093 Implement exclusions using regular expressions
The existing option to exclude files and directories, “--exclude”, is
implemented using fnmatch[1]. fnmatch matches the slash (“/”) with “*”
and thus makes it impossible to write patterns where a directory with
a given name should be excluded at a specific depth in the directory
hierarchy, but not anywhere else. Consider this structure:

  home/
  home/aaa
  home/aaa/.thumbnails
  home/user
  home/user/img
  home/user/img/.thumbnails

fnmatch incorrectly excludes “home/user/img/.thumbnails” with a pattern
of “home/*/.thumbnails” when the intention is to exclude “.thumbnails”
in all home directories while retaining directories with the same name
in all other locations.

With this change regular expressions are introduced as an additional
pattern syntax. The syntax is selected using a prefix on “--exclude”'s
value. “re:” is for regular expression and “fm:”, the default, selects
fnmatch. Selecting the syntax is necessary when regular expressions are
desired or when the desired fnmatch pattern starts with two alphanumeric
characters followed by a colon (i.e. “aa:something/*”). The exclusion
described above can be implemented as follows:

  --exclude 're:^home/[^/]+/\.thumbnails$'

The “--exclude-from” option permits loading exclusions from a text file
where the same prefixes can now be used, e.g. “re:\.tmp$”.

The documentation has been extended and now not only describes the two
pattern styles, but also the file format supported by “--exclude-from”.

This change has been discussed in issue #43 and in change request #497.

[1] https://docs.python.org/3/library/fnmatch.html

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
2016-01-13 17:39:19 +01:00
Leo Famulari 077ebe8c49 docs: Give project name in usage example.
* docs/usage.rst: Replace "|project_name|" with "borg" because the
abstraction doesn't work in usage examples.
2016-01-08 21:02:03 -05:00
Thomas Waldmann 57b913bc88 fix badly named environment variable, fixes #503
added: BORG_DELETE_I_KNOW_WHAT_I_AM_DOING for the check in "borg delete"
2015-12-20 02:03:33 +01:00
Thomas Waldmann 41eab542a8 add borg upgrade to the docs, fixes #464 2015-12-08 10:33:27 +01:00
Thomas Waldmann cb821b119b remove --log-level, add --debug and --info option, update docs
removed --log-level due to overlap with how --verbose works now.

for consistency, added --info as alias to --verbose (as the effect is
setting INFO log level).

also added --debug which sets DEBUG log level.
note: there are no messages emitted at DEBUG level yet.

WARNING is the default (because we want mostly silent behaviour,
except if something serious happens), so we don't need --warning
as an option.
2015-12-08 01:37:34 +01:00
Thomas Waldmann 21bd01ef16 add a --filter option replacing --changed/--unchanged
the problem here was that we do not just have changed and unchanged items,
but also a lot of items besides regular files which we just back up "as is" without
determining whether they are changed or not. thus, we can't support changed/unchanged
in a way users would expect them to work.

the A/M/U status only applies to the data content of regular files (compared to the index).
for all items, we ALWAYS save the metadata, there is no changed / not changed detection there.

thus, I replaced this with a --filter option where you can just specify which
status chars you want to see listed in the output.

E.g. --filter AM will only show regular files with A(dded) or M(odified) state, but nothing else.
Not giving --filter defaults to showing all items no matter what status they have.

Output is emitted via logger at info level, so it won't show up except if the logger is at that level.
2015-12-02 03:29:20 +01:00
Antoine Beaupré b09643e14f change file status test and cleanup last ref to --verbose
this ports the changes here to #445
2015-11-24 12:11:43 -05:00
Antoine Beaupré a062e8f821 update documentation to follow changes 2015-11-24 12:07:57 -05:00
Antoine Beaupré 48bb4c326d cross-reference the status oddity in the usage 2015-11-23 19:48:33 -05:00
Thomas Waldmann 25140e8c82 add --log-level to set the level of the builtin logging configuration, fixes #426 2015-11-21 02:09:16 +01:00
Thomas Waldmann c4dae52ca4 configure logging via env var, use LazyLogger
logging.raiseExceptions not needed any more for py >= 3.2
2015-11-21 01:14:07 +01:00
Thomas Waldmann 2e64c29e01 use ISO-8601 date and time format, fixes #375 2015-11-16 23:51:21 +01:00
Thomas Waldmann 38472900af add 'E' file status to docs 2015-11-16 15:38:06 +01:00
Thomas Waldmann d6b8de943b add docs for item flags / status output, fixes #402 2015-11-15 14:32:19 +01:00
Antoine Beaupré f13dd6e579 completely remove have_cython() hack
this was making us require mock, which is really a test component and
shouldn't be part of the runtime dependencies. furthermore, it was
making the imports and the code more brittle: it may have been
possible that, through an environment variable, backups could be
corrupted because mock libraries would be configured instead of real
once, which is a risk we shouldn't be taking.

finally, this was used only to build docs, which we will build and
commit to git by hand with a fully working borg when relevant.

see #384.
2015-11-13 10:40:53 -05:00
Thomas Waldmann b1eb784bd1 docs: add section about debug commands 2015-11-06 18:31:06 +01:00
Thomas Waldmann 6c1b765741 docs: group general stuff under 1 headline, fix another headline level 2015-11-06 18:22:30 +01:00
Thomas Waldmann bdf7dc65bd docs: add example for rename 2015-11-02 20:53:04 +01:00
Thomas Waldmann 734dae80ef improve chunker params docs, fixes #362 2015-11-02 19:47:09 +01:00
Thomas Waldmann 39fb9b176a update docs about return codes 2015-10-22 01:40:34 +02:00
Antoine Beaupré 76c0804bd5 explicitely commit to the units standard, see #289 2015-10-21 09:25:46 -04:00
Thomas Waldmann 908e944bdd include the help offered by borg help <topic> in the usage docs, fixes #293
it's not pretty yet, but better than nothing.
2015-10-17 21:53:09 +02:00
Antoine Beaupré e6c2359a60 add missing rename usage to docs, closes #279 2015-10-17 12:13:59 -04:00
Thomas Waldmann e7f25d7821 docs: use zlib,6 compression in some examples, fixes #275
This is what attic used by default, but borgbackup defaults to "no compression".

I just adjusted the command invocation, so we can keep the example output
(which shows that stuff was compressed).

Also: add FAQ item about compression.
2015-10-16 01:18:37 +02:00
Jakob Schnitzer fb62435fc6 docs: remove 'Additional Notes' from TOC, fix markup
What's covered in the 'Additional Notes' section of the documentation
hardly seems important enough to deserve its own entry in the sidebar.
2015-10-13 16:50:27 +02:00
Jakob Schnitzer b42bbc6f68 docs: fix code blocks 2015-10-13 16:31:25 +02:00
Antoine Beaupré 7ba4d47f6e clarify the class name part 2015-10-08 15:31:46 -04:00
Antoine Beaupré 2f803b6489 fix typo, split sentence 2015-10-08 15:31:46 -04:00
Antoine Beaupré 6f9e04bc21 generalise the cython check hack
instead of applying this only to usage generation, use it as a generic
mechanism to disable loading of Cython code.

it may be incomplete: there may be other places where Cython code is
loaded that is not checked, but that is sufficient to build the usage
docs. the environment variable used is documented as such in the
docs/usage.rst.

we also move the check to a helper function and document it
better. this has the unfortunate side effect of moving includes
around, but I can't think of a better way.
2015-10-08 08:56:02 -04:00
Antoine Beaupré a0ef4e25dd add support for arbitrary SSH commands (attic#99)
while SSH options can be specified through `~/.ssh/config`, some users
may want to use a completely different SSH command for their backups,
without overriding their $PATH variable. it may also be easier to do
ad-hoc configuration and tests that way.

plus, the POLA tells us that users expects something like this to be
supported by commands that talk to ssh. it is supported by rsync, git
and so on.
2015-10-05 18:54:00 -04:00
Thomas Waldmann bf3cf21ac5 docs: add warning about prune 2015-10-03 14:12:16 +02:00
Thomas Waldmann 86502d2729 docs: explain --read-special in more detail, fixes #220 2015-09-26 14:24:37 +02:00
Thomas Waldmann cff7dffc95 detect lz4.h header file location
use similar code as for openssl headers
2015-09-12 19:38:38 +02:00
TW 947fc095d8 Merge pull request #183 from ThomasWaldmann/borg-repo-envvar
BORG_REPO env var support
2015-09-06 21:51:24 +02:00
Thomas Waldmann b3f5231bac BORG_REPO env var support
sets the default repository to use, e.g. like:

export BORG_REPO=/mnt/backup/repo
borg init
borg create ::archive
borg list
borg mount :: /mnt
fusermount -u /mnt
borg delete ::archive
2015-09-06 18:18:24 +02:00
Thomas Waldmann 0b1035746e read special files as if they were regular files, update docs, closes #79
do not use the files cache for such special files
2015-09-06 00:29:46 +02:00
Thomas Waldmann c823554b6b docs: usage: improved formatting, cosmetic changes 2015-08-29 04:00:22 +02:00
Thomas Waldmann 1d16e7a37c compression: update / refine docs 2015-08-15 15:45:15 +02:00
Thomas Waldmann 8b1d46caa4 docs: more about compression 2015-08-10 20:36:21 +02:00
Thomas Waldmann 9d21e4ad69 docs: add some words about resource usage (fixed wording) 2015-07-29 21:48:57 +02:00
Thomas Waldmann 1e097bfd6b docs: add some words about resource usage 2015-07-29 21:39:20 +02:00
Thomas Waldmann 729cc4d82d document how to backup raw disk 2015-07-27 22:27:13 +02:00
Thomas Waldmann 50c0bb0c32 Merge branch 'master' into keyfile-in-repo 2015-07-15 00:05:18 +02:00
Thomas Waldmann b644565546 repo key mode (and deprecate passphrase mode), fixes #85
see usage.rst change for a description and why this is needed
2015-07-15 00:01:07 +02:00
Thomas Waldmann f330b4bd2a some doc updates, see below
faq about redundancy / integrity
compression is optional
having borg installed on backup server is optional (but faster)
cygwin installation tipps
do not document passphrase encryption mode example, use keyfile mode
2015-07-14 21:31:35 +02:00
Thomas Waldmann 3c34ef8145 clarify that borg extract uses the cwd as extraction target 2015-07-14 20:25:10 +02:00
Thomas Waldmann afae720112 document environment variables 2015-07-11 20:08:22 +02:00
Thomas Waldmann d1bb892c3d fix placement of return codes docs 2015-07-11 19:45:37 +02:00
Thomas Waldmann 05b21e3c0d document return codes 2015-07-11 19:27:00 +02:00
Thomas Waldmann 54e8dd8419 misc chunker parameter changes
- use power-of-2 sizes / n bit hash mask so one can give them more easily
- chunker api: give seed first, so we can give *chunker_params after it
- fix some tests that aren't possible with 2^N
- make sparse file extraction zero detection flexible for variable chunk max size
2015-06-21 01:46:41 +02:00
Thomas Waldmann afc2dab71e docs: more borg (or project_name) 2015-05-15 19:22:52 +02:00
Thomas Waldmann 56fd96589b docs: make clear that remote repos used via ssh need a remote borg 2015-05-15 18:35:14 +02:00
Thomas Waldmann ff0c264e3e fix small doc bug in prune examples, fix attic #306
--monthly is old/deprecated, --keep-monthly is new way.
2015-05-15 01:07:04 +02:00
Thomas Waldmann 7cbff6925f Documentation for 'attic serve'
Thanks to @lfam (attic PR #277 )!

Note: As I already had refactored a lot of these pathes you changed, it was easier
to just cherry pick the hunks with the other changes and apply them manually.
2015-05-14 17:36:53 +02:00
Thomas Waldmann 35d06afd6b get rid of some .borg, be consistent with the backup repo name and path
it's pretty useless to have .borg as a directory extension, especially
since there is a README in there stating that this is a borg repo.

conistency:
"backup" is always used as relative backup repository path
"/mnt/backup" is always used as absolute repository path
2015-05-13 15:02:33 +02:00
Thomas Waldmann cb5c9b63b3 fork: s/attic/borg/g, fix URLs, add new section to AUTHORS
use borg instead attic except at the places where it was used:
- as toplevel package name, directory name, file name
- to refer to original attic

remove sphinx upload make command, will be replaced by github.io site later

remove references to binary downloads and linux packages for now

remove some software name references, fix grammar

use borgbackup rather than borg-backup (or borg) in URLs,
less name collision issues, better search results, no validity issues with "-"
2015-05-13 15:02:33 +02:00
Jonas Borgström 02a8172eee docs: More improvements 2014-04-06 22:47:22 +02:00
Jonas Borgström ead1511948 docs: More documentation improvements 2014-04-06 15:16:25 +02:00
Jonas Borgström 3982c34e6c Improve attic check documentation
Closes #24.
2014-02-26 23:13:48 +01:00
Dan Christensen 4c4018e1d7 Update prune documentation to use new command line options,
and also to say that the time that matters is the time each
backup completes.
2014-02-24 19:32:18 -05:00
Jonas Borgström 7b31f23722 Replace verify command with "extract --dry-run"
closes #25
2014-02-18 21:33:06 +01:00
Jonas Borgström faedaf8160 Basic repository consistency check functionality.
Still no archive metadata validation or repair functionality.
2014-02-05 00:04:30 +01:00
Dan Christensen 6b639e4c22 Update prune docs and a few other things in usage.rst. 2014-02-03 20:11:47 -05:00
Jonas Borgström 530dfd1558 Documentation update 2013-10-03 21:00:54 +02:00
Jonas Borgström a51a10a96c More documentation improvements. 2013-08-04 23:20:22 +02:00
Jonas Borgström a35339f2c2 Renamed commands.rst to usage.rst 2013-08-04 21:23:12 +02:00
Jonas Borgström b6c8392c03 More documentation work 2013-08-03 13:05:06 +02:00
Jonas Borgström 43a4bf6829 Updated documentation 2013-07-30 13:54:04 +02:00
Jonas Borgström b718a443a8 Project rename 2013-07-09 20:14:18 +02:00
Jonas Borgström 0c1d6e8179 Fix usage.rst syntax 2013-07-05 17:04:01 +02:00
Jonas Borgström f827b99ffe Improved documentation. 2013-07-05 12:32:56 +02:00