| 1 |
# |
| 2 |
# Example btrbk configuration file |
| 3 |
# |
| 4 |
# |
| 5 |
# Please refer to the btrbk.conf(5) man-page for a complete |
| 6 |
# description of all configuration options. |
| 7 |
# For more examples, see README.md included with this package. |
| 8 |
# |
| 9 |
# btrbk.conf(5): <https://digint.ch/btrbk/doc/btrbk.conf.5.html> |
| 10 |
# README.md: <https://digint.ch/btrbk/doc/readme.html> |
| 11 |
# |
| 12 |
# Note that the options can be overridden per volume/subvolume/target |
| 13 |
# in the corresponding sections. |
| 14 |
# |
| 15 |
|
| 16 |
|
| 17 |
# Enable transaction log |
| 18 |
transaction_log /var/log/btrbk.log |
| 19 |
|
| 20 |
# Specify SSH private key for remote connections |
| 21 |
ssh_identity /etc/btrbk/ssh/id_ed25519 |
| 22 |
ssh_user root |
| 23 |
|
| 24 |
# Use sudo if btrbk or lsbtr is run by regular user |
| 25 |
backend_local_user btrfs-progs-sudo |
| 26 |
|
| 27 |
# Enable stream buffer. Adding a buffer between the sending and |
| 28 |
# receiving side is generally a good idea. |
| 29 |
# NOTE: If enabled, make sure to install the "mbuffer" package! |
| 30 |
stream_buffer 256m |
| 31 |
|
| 32 |
# Directory in which the btrfs snapshots are created. Relative to |
| 33 |
# <volume-directory> of the volume section. |
| 34 |
# If not set, the snapshots are created in <volume-directory>. |
| 35 |
# |
| 36 |
# If you want to set a custom name for the snapshot (and backups), |
| 37 |
# use the "snapshot_name" option within the subvolume section. |
| 38 |
# |
| 39 |
# NOTE: btrbk does not automatically create this directory, and the |
| 40 |
# snapshot creation will fail if it is not present. |
| 41 |
# |
| 42 |
snapshot_dir _btrbk_snap |
| 43 |
|
| 44 |
# Always create snapshots. Set this to "ondemand" to only create |
| 45 |
# snapshots if the target volume is reachable. Set this to "no" if |
| 46 |
# snapshot creation is done by another instance of btrbk. |
| 47 |
#snapshot_create always |
| 48 |
|
| 49 |
# Perform incremental backups (set to "strict" if you want to prevent |
| 50 |
# creation of non-incremental backups if no parent is found). |
| 51 |
#incremental yes |
| 52 |
|
| 53 |
# Specify after what time (in full hours after midnight) backups/ |
| 54 |
# snapshots are considered as a daily backup/snapshot |
| 55 |
#preserve_hour_of_day 0 |
| 56 |
|
| 57 |
# Specify on which day of week weekly/monthly backups are to be |
| 58 |
# preserved. |
| 59 |
#preserve_day_of_week sunday |
| 60 |
|
| 61 |
# Preserve all snapshots for a minimum period of time. |
| 62 |
#snapshot_preserve_min 1d |
| 63 |
|
| 64 |
# Retention policy for the source snapshots. |
| 65 |
#snapshot_preserve <NN>h <NN>d <NN>w <NN>m <NN>y |
| 66 |
|
| 67 |
# Preserve all backup targets for a minimum period of time. |
| 68 |
#target_preserve_min no |
| 69 |
|
| 70 |
# Retention policy for backup targets: |
| 71 |
#target_preserve <NN>h <NN>d <NN>w <NN>m <NN>y |
| 72 |
|
| 73 |
# Retention policy for archives ("btrbk archive" command): |
| 74 |
#archive_preserve_min no |
| 75 |
#archive_preserve <NN>h <NN>d <NN>w <NN>m <NN>y |
| 76 |
|
| 77 |
# Enable compression for remote btrfs send/receive operations: |
| 78 |
#stream_compress no |
| 79 |
#stream_compress_level default |
| 80 |
#stream_compress_threads default |
| 81 |
|
| 82 |
# Enable lock file support: Ensures that only one instance of btrbk |
| 83 |
# can be run at a time. |
| 84 |
#lockfile /var/lock/btrbk.lock |
| 85 |
|
| 86 |
# Don't wait for transaction commit on deletion. Enable this to make |
| 87 |
# sure the deletion of subvolumes is committed to disk when btrbk |
| 88 |
# terminates. |
| 89 |
#btrfs_commit_delete no |
| 90 |
|
| 91 |
|
| 92 |
# |
| 93 |
# Volume section (optional): "volume <volume-directory>" |
| 94 |
# |
| 95 |
# <volume-directory> Base path within a btrfs filesystem |
| 96 |
# containing the subvolumes to be backuped |
| 97 |
# (usually the mount-point of a btrfs filesystem |
| 98 |
# mounted with subvolid=5 option). |
| 99 |
# |
| 100 |
# Subvolume section: "subvolume <subvolume-name>" |
| 101 |
# |
| 102 |
# <subvolume-name> Subvolume to be backuped, relative to |
| 103 |
# <volume-directory> in volume section. |
| 104 |
# |
| 105 |
# Target section: "target <type> <volume-directory>" |
| 106 |
# |
| 107 |
# <type> (optional) type, defaults to "send-receive". |
| 108 |
# <volume-directory> Directory within a btrfs filesystem |
| 109 |
# receiving the backups. |
| 110 |
# |
| 111 |
# NOTE: The parser does not care about indentation, this is only for |
| 112 |
# human readability. All options apply to the last section |
| 113 |
# encountered, overriding the corresponding option of the upper |
| 114 |
# section. This means that the global options must be set on top, |
| 115 |
# before any "volume", "subvolume" or "target section. |
| 116 |
# |
| 117 |
|
| 118 |
|
| 119 |
# |
| 120 |
# Example retention policy: |
| 121 |
# |
| 122 |
snapshot_preserve_min 2d |
| 123 |
snapshot_preserve 14d |
| 124 |
|
| 125 |
target_preserve_min no |
| 126 |
target_preserve 20d 10w *m |
| 127 |
|
| 128 |
|
| 129 |
# |
| 130 |
# Simple setup: Backup root and home to external disk |
| 131 |
# |
| 132 |
snapshot_dir /btrbk_snapshots |
| 133 |
target /mnt/btr_backup |
| 134 |
subvolume / |
| 135 |
subvolume /home |
| 136 |
|
| 137 |
|
| 138 |
# |
| 139 |
# Complex setup |
| 140 |
# |
| 141 |
# In order to keep things organized, it is recommended to use "volume" |
| 142 |
# sections and mount the top-level subvolume (subvolid=5): |
| 143 |
# |
| 144 |
# $ mount -o subvolid=5 /dev/sda1 /mnt/btr_pool |
| 145 |
# |
| 146 |
# Backup to external disk mounted on /mnt/btr_backup |
| 147 |
volume /mnt/btr_pool |
| 148 |
# Create snapshots in /mnt/btr_pool/btrbk_snapshots |
| 149 |
snapshot_dir btrbk_snapshots |
| 150 |
|
| 151 |
# Target for all subvolume sections: |
| 152 |
target /mnt/btr_backup |
| 153 |
|
| 154 |
# Some default btrfs installations (e.g. Ubuntu) use "@" for rootfs |
| 155 |
# (mounted at "/") and "@home" (mounted at "/home"). Note that this |
| 156 |
# is only a naming convention. |
| 157 |
#subvolume @ |
| 158 |
subvolume root |
| 159 |
subvolume home |
| 160 |
subvolume kvm |
| 161 |
# Use different retention policy for kvm backups: |
| 162 |
target_preserve 7d 4w |
| 163 |
|
| 164 |
|
| 165 |
# Backup data to external disk as well as remote host |
| 166 |
volume /mnt/btr_data |
| 167 |
subvolume data |
| 168 |
# Always create snapshot, even if targets are unreachable |
| 169 |
snapshot_create always |
| 170 |
target /mnt/btr_backup |
| 171 |
target ssh://backup.my-remote-host.com/mnt/btr_backup |
| 172 |
|
| 173 |
|
| 174 |
# Backup from remote host, with different naming |
| 175 |
volume ssh://my-remote-host.com/mnt/btr_pool |
| 176 |
subvolume data_0 |
| 177 |
snapshot_dir snapshots/btrbk |
| 178 |
snapshot_name data_main |
| 179 |
target /mnt/btr_backup/my-remote-host.com |
| 180 |
|
| 181 |
|
| 182 |
# Backup on demand (noauto) to remote host running busybox, login as |
| 183 |
# regular user using ssh-agent with current user name (ssh_user no) |
| 184 |
# and default credentials (ssh_identity no). |
| 185 |
volume /home |
| 186 |
noauto yes |
| 187 |
compat busybox |
| 188 |
backend_remote btrfs-progs-sudo |
| 189 |
ssh_user no |
| 190 |
ssh_identity no |
| 191 |
|
| 192 |
target ssh://my-user-host.com/mnt/btr_backup/home |
| 193 |
subvolume alice |
| 194 |
subvolume bob |
| 195 |
|
| 196 |
|
| 197 |
# Resume backups from remote host which runs its own btrbk instance |
| 198 |
# creating snapshots for "home" in "/mnt/btr_pool/btrbk_snapshots". |
| 199 |
volume ssh://my-remote-host.com/mnt/btr_pool |
| 200 |
snapshot_dir btrbk_snapshots |
| 201 |
snapshot_create no |
| 202 |
snapshot_preserve_min all |
| 203 |
subvolume home |
| 204 |
target /mnt/btr_backup/my-remote-host.com |