File: tar.rst

package info (click to toggle)
borgbackup2 2.0.0b20-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,852 kB
  • sloc: python: 33,830; pascal: 3,599; sh: 215; makefile: 156; tcl: 94; ansic: 21
file content (57 lines) | stat: -rw-r--r-- 1,685 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.. include:: export-tar.rst.inc

.. include:: import-tar.rst.inc

Examples
~~~~~~~~
::

    # Export as an uncompressed tar archive
    $ borg export-tar Monday Monday.tar

    # Import an uncompressed tar archive
    $ borg import-tar Monday Monday.tar

    # Exclude some file types and compress using gzip
    $ borg export-tar Monday Monday.tar.gz --exclude '*.so'

    # Use a higher compression level with gzip
    $ borg export-tar --tar-filter="gzip -9" Monday Monday.tar.gz

    # Copy an archive from repoA to repoB
    $ borg -r repoA export-tar --tar-format=BORG archive - | borg -r repoB import-tar archive -

    # Export a tar, but instead of storing it on disk, upload it to a remote site using curl
    $ borg export-tar Monday - | curl --data-binary @- https://somewhere/to/POST

    # Remote extraction via 'tarpipe'
    $ borg export-tar Monday - | ssh somewhere "cd extracted; tar x"

Archives transfer script
~~~~~~~~~~~~~~~~~~~~~~~~

Outputs a script that copies all archives from repo1 to repo2:

::

    for N I T in `borg list --format='{archive} {id} {time:%Y-%m-%dT%H:%M:%S}{NL}'`
    do
      echo "borg -r repo1 export-tar --tar-format=BORG aid:$I - | borg -r repo2 import-tar --timestamp=$T $N -"
    done

Kept:

- archive name, archive timestamp
- archive contents (all items with metadata and data)

Lost:

- some archive metadata (like the original command line, execution time, etc.)

Please note:

- all data goes over that pipe, again and again for every archive
- the pipe is dumb, there is no data or transfer time reduction there due to deduplication
- maybe add compression
- pipe over ssh for remote transfer
- no special sparse file support