aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 123e7a0b99c9b9513c1d92f7bb0645333b681def (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Borger

A script for home folder backups using [Borg](https://borgbackup.readthedocs.io).

# Features

* Multiple destinations using config files.
* Automatically initializes repository in the remote destination.
* Automatically pruning of old backups.

# Usage

Create a config for your `servername` destination at `~/.config/borger/servername`:

    # Backup destination
    export SSH_SERVER="user@host"
    export SSH_PORT="2202"
  
    # Repository path
    export BORG_REPO_DIR="/var/backups/users/$USER/borg"
    export BORG_REPO="ssh://$SSH_SERVER:$SSH_PORT/$BORG_REPO_DIR"
  
    # Setting one of those, so you won't be asked for your repository passphrase:
    #export BORG_PASSPHRASE='HACKME'
    #export BORG_PASSCOMMAND='pass show backup'
    #export BORG_PASSCOMMAND='keyringer default decrypt borg 2> /dev/null'

Then run borger:

    borger servername

If you want to backup to local folder or a locally-mounted USB disk, use the
following config at `~/.config/borger/my-disk`:

    # Repository path
    export BORG_REPO="/media/my-disk/backups/users/$USER/borg"

    # Setting one of those, so you won't be asked for your repository passphrase:
    #export BORG_PASSPHRASE='HACKME'
    #export BORG_PASSCOMMAND='pass show backup'
    #export BORG_PASSCOMMAND='keyringer default decrypt borg 2> /dev/null'

Then run borger normally:

    borger my-disk

Note that `BORGER_REPO` param assumes that the path is available. If this path represents
a mountpoint for an external drive then you should mount it manually.

# Optional config

These include:

    # Optional backup config
    export KEEPDAILY="7"         # how many days   to keep
    export KEEPWEEKLY="4"        # how many weeks  to keep
    export KEEPMONTHLY="6"       # how many months to keep
    export ENCRYPTION="keyfile"  # encryption strategy, PAY ATTENTION TO THIS
    export PLACEHOLDER="{user}"  # placeholder to tag archives
    export INTERVAL="1h"         # interval between backups in the continuous mode

# Continuous backups

If you want to run your backups continuously, use

    borger servername --continuous

By default `borger` waits `1h` before starting the new backup procedure which
can be adjusted using the `INTERVAL` config variable. See [this
issue](https://github.com/borgbackup/borg/issues/325) for a discussion on
continous backups.

# Checking your backups

As simply as

    borger servername --check
    borger mydisk     --check

# WARNING

Borger uses `keyfile` encrytion by default. That means **you should backup your keyfile**
somewhere else. **If you don't want that, use `encryption="repokey"` at your config.**

See [Repository Encryption](https://borgbackup.readthedocs.io/en/stable/quickstart.html#repository-encryption)
for details.