dar-backup 0.6.21__py3-none-any.whl → 0.7.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dar_backup/Changelog.md +35 -2
- dar_backup/README.md +433 -97
- dar_backup/__about__.py +1 -1
- dar_backup/clean_log.py +3 -0
- dar_backup/cleanup.py +13 -7
- dar_backup/command_runner.py +2 -0
- dar_backup/config_settings.py +18 -0
- dar_backup/dar-backup.conf +4 -2
- dar_backup/dar-backup.conf.j2 +64 -0
- dar_backup/dar_backup.py +19 -13
- dar_backup/dar_backup_systemd.py +3 -0
- dar_backup/demo.py +153 -77
- dar_backup/demo_backup_def.j2 +62 -0
- dar_backup/exceptions.py +2 -0
- dar_backup/installer.py +119 -4
- dar_backup/manager.py +9 -4
- dar_backup/rich_progress.py +4 -0
- dar_backup/util.py +107 -13
- {dar_backup-0.6.21.dist-info → dar_backup-0.7.2.dist-info}/METADATA +454 -98
- dar_backup-0.7.2.dist-info/RECORD +25 -0
- dar_backup-0.6.21.dist-info/RECORD +0 -23
- {dar_backup-0.6.21.dist-info → dar_backup-0.7.2.dist-info}/WHEEL +0 -0
- {dar_backup-0.6.21.dist-info → dar_backup-0.7.2.dist-info}/entry_points.txt +0 -0
- {dar_backup-0.6.21.dist-info → dar_backup-0.7.2.dist-info}/licenses/LICENSE +0 -0
dar_backup/README.md
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
**Reliable DAR backups, automated in clean Python**
|
|
5
5
|
|
|
6
|
-
[](https://codecov.io/gh/per2jensen/dar-backup)
|
|
7
|
+
[](https://snyk.io/test/github/per2jensen/dar-backup)
|
|
7
8
|

|
|
8
9
|
[](https://pypi.org/project/dar-backup/)
|
|
9
|
-
[](https://pypi.org/project/dar-backup/)
|
|
11
|
+
[](https://github.com/per2jensen/dar-backup/blob/main/v2/doc/weekly_clones.png)
|
|
12
|
+
[](https://github.com/per2jensen/dar-backup/blob/main/v2/doc/weekly_clones.png)
|
|
11
13
|
|
|
12
14
|
The wonderful 'dar' [Disk Archiver](https://github.com/Edrusb/DAR) is used for
|
|
13
15
|
the heavy lifting, together with the [parchive](https://github.com/Parchive/par2cmdline) suite in these scripts.
|
|
@@ -16,14 +18,16 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
16
18
|
|
|
17
19
|
## TL;DR
|
|
18
20
|
|
|
19
|
-
`dar-backup` is a Python-powered CLI for creating and validating full, differential, and incremental backups using dar and par2
|
|
21
|
+
`dar-backup` is a Python-powered CLI for creating and validating full, differential, and incremental backups using `dar` and `par2`. Designed for long-term restore integrity, even on user-space filesystems like FUSE.
|
|
20
22
|
|
|
21
23
|
## Table of Contents
|
|
22
24
|
|
|
23
25
|
- [Reliable `dar` backups wrapped in Python](#dar-backup)
|
|
24
26
|
- [My use case](#my-use-case)
|
|
27
|
+
- [Features](#features)
|
|
25
28
|
- [License](#license)
|
|
26
29
|
- [Changelog version 2](https://github.com/per2jensen/dar-backup/blob/main/v2/Changelog.md)
|
|
30
|
+
- [Quick Guide](#quick-guide)
|
|
27
31
|
- [Status](#status)
|
|
28
32
|
- [GPG Signing key](#gpg-signing-key)
|
|
29
33
|
- [Breaking change in version 0.6.0](#breaking-change-in-version-060)
|
|
@@ -35,7 +39,7 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
35
39
|
- [1 - installation](#1---installation)
|
|
36
40
|
- [2 - configuration](#2---configuration)
|
|
37
41
|
- [3 - generate catalog databases](#3---generate-catalog-databases)
|
|
38
|
-
- [4 -
|
|
42
|
+
- [4 - give `dar-backup` a spin](#4---give-dar-backup-a-spin)
|
|
39
43
|
- [5 - deactivate venv](#5---deactivate-venv)
|
|
40
44
|
- [Config](#config)
|
|
41
45
|
- [Config file](#config-file)
|
|
@@ -70,6 +74,7 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
70
74
|
- [Skipping cache directories](#skipping-cache-directories)
|
|
71
75
|
- [Progress bar + current directory](#progress-bar-and-current-directory)
|
|
72
76
|
- [Shell Autocompletion](#shell-autocompletion)
|
|
77
|
+
- [Easy development setup](#easy-development-setup)
|
|
73
78
|
- [Todo](#todo)
|
|
74
79
|
- [Known Limitations / Edge Cases](#known-limitations--edge-cases)
|
|
75
80
|
- [Reference](#reference)
|
|
@@ -79,21 +84,22 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
79
84
|
- [manager](#manager-options)
|
|
80
85
|
- [cleanup](#cleanup-options)
|
|
81
86
|
- [clean-log](#clean-log-options)
|
|
82
|
-
- [dar-backup-systemd](#dar-backup-systemd)
|
|
83
|
-
- [Installer](#installer)
|
|
84
|
-
- [demo](#demo)
|
|
87
|
+
- [dar-backup-systemd](#dar-backup-systemd-options)
|
|
88
|
+
- [Installer](#installer-options)
|
|
89
|
+
- [demo](#demo-options)
|
|
85
90
|
|
|
86
91
|
## My use case
|
|
87
92
|
|
|
88
|
-
I
|
|
93
|
+
I needed the following:
|
|
89
94
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
95
|
+
- Backup my workstation to a remote server
|
|
96
|
+
- Backup primarily photos, home made video and different types of documents
|
|
97
|
+
- I have cloud storage mounted on a directory within my home dir. The filesystem is [FUSE based](https://www.kernel.org/doc/html/latest/filesystems/fuse.html), which gives it a few special features
|
|
92
98
|
|
|
93
|
-
I
|
|
99
|
+
- Backup cloud storage (cloud is convenient, but I want control over my backups)
|
|
100
|
+
- A non-privileged user can perform a mount
|
|
101
|
+
- A privileged user cannot look into the filesystem --> a backup script running as root is not suitable
|
|
94
102
|
|
|
95
|
-
- Backup my cloud storage to something local (cloud is convenient, but I want control over my backups)
|
|
96
|
-
- Backup primarily photos, video and different types of documents
|
|
97
103
|
- Have a simple way of restoring, possibly years into the future. 'dar' fits that scenario with a single statically linked binary (kept with the archives). There is no need install/configure anything - restoring is simple and works well.
|
|
98
104
|
- During backup archives must be tested and a restore test (however small) performed
|
|
99
105
|
- Archives stored on a server with a reliable file system (easy to mount a directory over sshfs)
|
|
@@ -101,11 +107,252 @@ I have cloud storage mounted on a directory within my home dir. The filesystem i
|
|
|
101
107
|
|
|
102
108
|
I do not need the encryption features of dar, as all storage is already encrypted.
|
|
103
109
|
|
|
110
|
+
## Features
|
|
111
|
+
|
|
112
|
+
- The battle tested [dar](https://github.com/Edrusb/DAR) Disk Archiver is used for the actual backups - it comes highly recommended.
|
|
113
|
+
- Backup with test of backup and (configurable) restore tests of files with comparison to source
|
|
114
|
+
- [Redundancy files](#par2) created for patching bitrot of the archives (size configurable)
|
|
115
|
+
- Simple [backup definitions](#backup-definition-example) defining what to backup (as many as you need)
|
|
116
|
+
- [Backup catalogs](#dar-manager-databases) in databases, optionally on a disk different from the backups
|
|
117
|
+
- Flexible and precise logging
|
|
118
|
+
- Bash and zsh shell autocompletion for a nice CLI experience, [available completions](#shell-autocompletion):
|
|
119
|
+
|
|
120
|
+
- Options for `dar-backup`, `cleanup`, `manager`
|
|
121
|
+
- Backup definitions
|
|
122
|
+
- Archives - filtered to backup definition if given
|
|
123
|
+
- Catalogs - filtered to backup definition if given
|
|
124
|
+
|
|
125
|
+
- `dar-backup` is easy to install and configure.
|
|
126
|
+
|
|
127
|
+
- ✅ The author has used dar-backup since > 4 years, and has been saved multiple times.
|
|
128
|
+
|
|
104
129
|
## License
|
|
105
130
|
|
|
106
131
|
These scripts are licensed under the GPLv3 license.
|
|
107
132
|
Read more here: [GNU GPL3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), or have a look at the ["LICENSE"](https://github.com/per2jensen/dar-backup/blob/main/LICENSE) file in this repository.
|
|
108
133
|
|
|
134
|
+
## Quick Guide
|
|
135
|
+
|
|
136
|
+
This purpose of this quick guide is to show how `dar-backup` works in a few simple steps.
|
|
137
|
+
|
|
138
|
+
The package include a `demo`application, that can help you set up `dar-backup` quickly.
|
|
139
|
+
|
|
140
|
+
> ⚠️ **Assumption**
|
|
141
|
+
>
|
|
142
|
+
> The demo program uses these directories in your home directory:
|
|
143
|
+
>
|
|
144
|
+
> - $HOME/dar-backup
|
|
145
|
+
> - $HOME/.config/dar-backup
|
|
146
|
+
>
|
|
147
|
+
> It is assumed they **do not exist** before running the demo.
|
|
148
|
+
>
|
|
149
|
+
> Python **>= 3.9** is required
|
|
150
|
+
|
|
151
|
+
<br>
|
|
152
|
+
|
|
153
|
+
**Let's roll** with installation, backup, list backup content, restore & restore check
|
|
154
|
+
|
|
155
|
+
The demo is known to work on an Ubuntu 24.04 clean VM as delivered from `Multipass`
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
sudo apt -y install dar par2 python3 python3-venv
|
|
159
|
+
INSTALL_DIR=/tmp/dar-backup
|
|
160
|
+
mkdir "$INSTALL_DIR"
|
|
161
|
+
cd "$INSTALL_DIR"
|
|
162
|
+
python3 -m venv venv # create the virtual environment
|
|
163
|
+
. venv/bin/activate # activate the virtual environment
|
|
164
|
+
pip install dar-backup # run pip to install `dar-backup` into the virtual environment
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
<details>
|
|
168
|
+
|
|
169
|
+
<summary>🎯 Install details</summary>
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
(venv) $ INSTALL_DIR=/tmp/dar-backup
|
|
173
|
+
mkdir "$INSTALL_DIR"
|
|
174
|
+
cd "$INSTALL_DIR"
|
|
175
|
+
python3 -m venv venv # create the virtual environment
|
|
176
|
+
. venv/bin/activate # activate the virtual environment
|
|
177
|
+
pip install dar-backup # run pip to install `dar-backup`
|
|
178
|
+
Collecting dar-backup
|
|
179
|
+
Downloading dar_backup-0.6.21-py3-none-any.whl.metadata (88 kB)
|
|
180
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.5/88.5 kB 3.7 MB/s eta 0:00:00
|
|
181
|
+
Collecting argcomplete>=3.6.2 (from dar-backup)
|
|
182
|
+
Using cached argcomplete-3.6.2-py3-none-any.whl.metadata (16 kB)
|
|
183
|
+
Collecting inputimeout>=1.0.4 (from dar-backup)
|
|
184
|
+
Using cached inputimeout-1.0.4-py3-none-any.whl.metadata (2.2 kB)
|
|
185
|
+
Collecting rich>=13.0.0 (from dar-backup)
|
|
186
|
+
Using cached rich-14.0.0-py3-none-any.whl.metadata (18 kB)
|
|
187
|
+
Collecting markdown-it-py>=2.2.0 (from rich>=13.0.0->dar-backup)
|
|
188
|
+
Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
|
|
189
|
+
Collecting pygments<3.0.0,>=2.13.0 (from rich>=13.0.0->dar-backup)
|
|
190
|
+
Using cached pygments-2.19.1-py3-none-any.whl.metadata (2.5 kB)
|
|
191
|
+
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=13.0.0->dar-backup)
|
|
192
|
+
Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
|
|
193
|
+
Downloading dar_backup-0.6.21-py3-none-any.whl (101 kB)
|
|
194
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.9/101.9 kB 16.2 MB/s eta 0:00:00
|
|
195
|
+
Using cached argcomplete-3.6.2-py3-none-any.whl (43 kB)
|
|
196
|
+
Using cached inputimeout-1.0.4-py3-none-any.whl (4.6 kB)
|
|
197
|
+
Using cached rich-14.0.0-py3-none-any.whl (243 kB)
|
|
198
|
+
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
|
|
199
|
+
Using cached pygments-2.19.1-py3-none-any.whl (1.2 MB)
|
|
200
|
+
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
|
|
201
|
+
Installing collected packages: pygments, mdurl, inputimeout, argcomplete, markdown-it-py, rich, dar-backup
|
|
202
|
+
Successfully installed argcomplete-3.6.2 dar-backup-0.6.21 inputimeout-1.0.4 markdown-it-py-3.0.0 mdurl-0.1.2 pygments-2.19.1 rich-14.0.0
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
</details>
|
|
206
|
+
|
|
207
|
+
Setup the demo configurations and show a few operations
|
|
208
|
+
|
|
209
|
+
<br>
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# See reference section for options tweaking the install
|
|
213
|
+
demo --install
|
|
214
|
+
|
|
215
|
+
# create catalog database
|
|
216
|
+
manager --create-db
|
|
217
|
+
|
|
218
|
+
# FULL backup as defined in backup definition `demo`
|
|
219
|
+
dar-backup --full-backup
|
|
220
|
+
|
|
221
|
+
# List the contents of the backup
|
|
222
|
+
dar-backup --list-contents demo_FULL_$(date '+%F')
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
<details>
|
|
226
|
+
|
|
227
|
+
<summary>🎯 --list details</summary>
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
(venv) $ demo --install
|
|
231
|
+
Directories created.
|
|
232
|
+
File generated at '/home/user/.config/dar-backup/backup.d/demo'
|
|
233
|
+
File generated at '/home/user/.config/dar-backup/dar-backup.conf'
|
|
234
|
+
1. Now run `manager --create-db` to create the catalog database.
|
|
235
|
+
2. Then you can run `dar-backup --full-backup` to create a backup.
|
|
236
|
+
3. List backups with `dar-backup --list`
|
|
237
|
+
4. List contents of a backup with `dar-backup --list-contents <backup-name>`
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
(venv) $ manager --create-db
|
|
242
|
+
========== Startup Settings ==========
|
|
243
|
+
manager.py: 0.7.1
|
|
244
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
245
|
+
Logfile: /home/user/dar-backup/dar-backup.log
|
|
246
|
+
dar_manager: /home/user/.local/dar/bin/dar_manager
|
|
247
|
+
dar_manager v.: 1.9.0
|
|
248
|
+
======================================
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
(venv) $ dar-backup --full-backup
|
|
253
|
+
========== Startup Settings ==========
|
|
254
|
+
dar-backup.py: 0.7.1
|
|
255
|
+
dar path: /home/user/.local/dar/bin/dar
|
|
256
|
+
dar version: 2.7.17
|
|
257
|
+
Script directory: /home/user/git/dar-backup/v2/src/dar_backup
|
|
258
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
259
|
+
.darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
|
|
260
|
+
======================================
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
(venv) $ dar-backup --list-contents demo_FULL_$(date '+%F')
|
|
265
|
+
========== Startup Settings ==========
|
|
266
|
+
dar-backup.py: 0.7.1
|
|
267
|
+
dar path: /home/user/.local/dar/bin/dar
|
|
268
|
+
dar version: 2.7.17
|
|
269
|
+
Script directory: /home/user/git/dar-backup/v2/src/dar_backup
|
|
270
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
271
|
+
.darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
|
|
272
|
+
======================================
|
|
273
|
+
[Saved][-] [-L-][ 49%][ ] drwx------ user user 8 kio Sat May 17 13:13:59 2025 .config
|
|
274
|
+
[Saved][-] [-L-][ 49%][ ] drwxrwxr-x user user 8 kio Tue May 6 20:55:40 2025 .config/dar-backup
|
|
275
|
+
[Saved][-] [-L-][ 48%][ ] drwxrwxr-x user user 6 kio Sat May 17 13:26:21 2025 .config/dar-backup/backup.d
|
|
276
|
+
[Saved][ ] [-L-][ 40%][ ] -rw-rw-r-- user user 764 o Sun Feb 23 21:23:01 2025 .config/dar-backup/backup.d/media-files
|
|
277
|
+
[Saved][ ] [-L-][ 41%][ ] -rw-rw-r-- user user 933 o Sun Feb 23 21:23:15 2025 .config/dar-backup/backup.d/pCloudDrive
|
|
278
|
+
[Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 1 kio Sun Mar 16 10:40:29 2025 .config/dar-backup/backup.d/test
|
|
279
|
+
[Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 824 o Tue May 13 17:00:52 2025 .config/dar-backup/backup.d/default
|
|
280
|
+
[Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 1 kio Sat May 3 10:40:33 2025 .config/dar-backup/backup.d/user-homedir
|
|
281
|
+
[Saved][ ] [-L-][ 54%][ ] -rw-rw-r-- user user 1 kio Sat May 17 18:17:40 2025 .config/dar-backup/backup.d/demo
|
|
282
|
+
[Saved][ ] [-L-][ 55%][ ] -rw-rw-r-- user user 1 kio Sat May 17 18:17:40 2025 .config/dar-backup/dar-backup.conf
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
</details>
|
|
286
|
+
|
|
287
|
+
<br>
|
|
288
|
+
|
|
289
|
+
Perform a restore and show the restored files
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
# Restore all files in the backup
|
|
293
|
+
dar-backup --restore demo_FULL_$(date '+%F') --verbose
|
|
294
|
+
|
|
295
|
+
# Prove the files have been restored to directory as configured
|
|
296
|
+
find $HOME/dar-backup/restore
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
<details>
|
|
300
|
+
|
|
301
|
+
<summary>🎯 --restore details</summary>
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
(venv) $ dar-backup --restore demo_FULL_$(date '+%F') --verbose
|
|
305
|
+
========== Startup Settings ==========
|
|
306
|
+
dar-backup.py: 0.7.1
|
|
307
|
+
dar path: /home/user/.local/dar/bin/dar
|
|
308
|
+
dar version: 2.7.17
|
|
309
|
+
Script directory: /home/user/git/dar-backup/v2/src/dar_backup
|
|
310
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
311
|
+
.darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
|
|
312
|
+
Backup.d dir: /home/user/.config/dar-backup/backup.d
|
|
313
|
+
Backup dir: /home/user/dar-backup/backups
|
|
314
|
+
Restore dir: /home/user/dar-backup/restore
|
|
315
|
+
Logfile location: /home/user/dar-backup/dar-backup.log
|
|
316
|
+
PAR2 enabled: True
|
|
317
|
+
--do-not-compare: False
|
|
318
|
+
======================================
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
(venv) $ find ~/dar-backup/restore/
|
|
323
|
+
/home/user/dar-backup/restore/
|
|
324
|
+
/home/user/dar-backup/restore/.config
|
|
325
|
+
/home/user/dar-backup/restore/.config/dar-backup
|
|
326
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d
|
|
327
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/media-files
|
|
328
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/pCloudDrive
|
|
329
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/test
|
|
330
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/default
|
|
331
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/user-homedir
|
|
332
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/demo
|
|
333
|
+
/home/user/dar-backup/restore/.config/dar-backup/dar-backup.conf
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
</details>
|
|
337
|
+
|
|
338
|
+
<br>
|
|
339
|
+
|
|
340
|
+
> ✅ **Next steps**
|
|
341
|
+
>
|
|
342
|
+
> Play with `demo's` options:
|
|
343
|
+
>
|
|
344
|
+
> - --root-dir (perhaps $HOME)
|
|
345
|
+
> - --dir-to-backup (perhaps Pictures)
|
|
346
|
+
> - --backup-dir (perhaps /media/user/big-disk)
|
|
347
|
+
>
|
|
348
|
+
> See log file: `cat "$HOME/dar-backup/dar-backup.log"`
|
|
349
|
+
>
|
|
350
|
+
> Checkout [systemd timers and services](#generate-systemd-files)
|
|
351
|
+
>
|
|
352
|
+
> Checkout [shell autocompletion (very nice !)](#shell-autocompletion)
|
|
353
|
+
>
|
|
354
|
+
> Checkout the [reference section](#reference)
|
|
355
|
+
|
|
109
356
|
## Status
|
|
110
357
|
|
|
111
358
|
As of August 8, 2024 I am using the alpha versions of `dar-backup` (alpha-0.5.9 onwards) in my automated backup routine.
|
|
@@ -227,8 +474,9 @@ Please review the [Code of Conduct](https://github.com/per2jensen/dar-backup/blo
|
|
|
227
474
|
|
|
228
475
|
## Requirements
|
|
229
476
|
|
|
477
|
+
- A linux system
|
|
230
478
|
- dar
|
|
231
|
-
- par2
|
|
479
|
+
- parchive (par2)
|
|
232
480
|
- python3
|
|
233
481
|
- python3-venv
|
|
234
482
|
|
|
@@ -281,7 +529,7 @@ See more [here](#gpg-signing-key).
|
|
|
281
529
|
|
|
282
530
|
### 1 - installation
|
|
283
531
|
|
|
284
|
-
Installation is currently in a venv. These commands are installed in the venv:
|
|
532
|
+
Installation is currently in a [virtual environment](https://csguide.cs.princeton.edu/software/virtualenv) (commonly called a `venv`). These commands are installed in the venv:
|
|
285
533
|
|
|
286
534
|
- dar-back
|
|
287
535
|
- cleanup
|
|
@@ -293,15 +541,15 @@ Installation is currently in a venv. These commands are installed in the venv:
|
|
|
293
541
|
|
|
294
542
|
Note:
|
|
295
543
|
|
|
296
|
-
The
|
|
544
|
+
The modules `inputimeout`, `rich`and `argcomplete` are installed into the venv and used by `dar-backup`
|
|
297
545
|
|
|
298
|
-
To install
|
|
546
|
+
To install `dar-backup`, create a venv and run pip:
|
|
299
547
|
|
|
300
548
|
```bash
|
|
301
549
|
mkdir $HOME/tmp
|
|
302
550
|
cd $HOME/tmp
|
|
303
551
|
python3 -m venv venv # create the virtual environment
|
|
304
|
-
. venv/bin/activate # activate the virtual
|
|
552
|
+
. venv/bin/activate # activate the virtual environment
|
|
305
553
|
pip install dar-backup # run pip to install `dar-backup`
|
|
306
554
|
```
|
|
307
555
|
|
|
@@ -314,7 +562,7 @@ alias db=". ~/tmp/venv/bin/activate; dar-backup -v"
|
|
|
314
562
|
drop the alias into ~/.bashrc like this:
|
|
315
563
|
|
|
316
564
|
```bash
|
|
317
|
-
grep -qxF 'alias db="
|
|
565
|
+
grep -qxF 'alias db="' ~/.bashrc \
|
|
318
566
|
|| echo 'alias db=". ~/tmp/venv/bin/activate; dar-backup -v"' >> ~/.bashrc
|
|
319
567
|
|
|
320
568
|
source ~/.bashrc
|
|
@@ -333,24 +581,25 @@ See section 15 and section 16 in the supplied "LICENSE" file.
|
|
|
333
581
|
|
|
334
582
|
### 2 - configuration
|
|
335
583
|
|
|
336
|
-
The dar-backup
|
|
584
|
+
The dar-backup [installer](#installer-options) application can be used to setup the needed directories for `dar-backup` to work.
|
|
585
|
+
It creates necessary directories as prescribed in the config file and optionally creates manager databases.
|
|
337
586
|
|
|
338
|
-
|
|
587
|
+
`installer` can also add configuration of shell auto completion.
|
|
339
588
|
|
|
340
|
-
|
|
341
|
-
demo --install
|
|
342
|
-
```
|
|
589
|
+
Step 1:
|
|
343
590
|
|
|
344
|
-
|
|
591
|
+
Create a config file - [see details on config file](#config-file))
|
|
345
592
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
593
|
+
Step 2:
|
|
594
|
+
|
|
595
|
+
Create one or more backup definitions - [see details on backup definitions](#backup-definition-example)
|
|
596
|
+
|
|
597
|
+
Step 3:
|
|
598
|
+
|
|
599
|
+
Run the installer:
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
installer --config <path to dar-backup.conf> --install-autocompletion
|
|
354
603
|
```
|
|
355
604
|
|
|
356
605
|
### 3 - generate catalog databases
|
|
@@ -363,22 +612,33 @@ Generate the archive catalog database(s).
|
|
|
363
612
|
manager --create-db
|
|
364
613
|
```
|
|
365
614
|
|
|
366
|
-
### 4 -
|
|
615
|
+
### 4 - give dar-backup a spin
|
|
367
616
|
|
|
368
|
-
|
|
369
|
-
[Backup definitions](#backup-definition-example) are in place in BACKUP.D_DIR (see [config file](#config-file)).
|
|
617
|
+
You are now ready to do backups as configured in your backup definition(s).
|
|
370
618
|
|
|
371
|
-
|
|
619
|
+
Give `dar-backup`a spin:
|
|
372
620
|
|
|
373
621
|
```bash
|
|
374
|
-
dar-backup --full-backup
|
|
622
|
+
dar-backup --full-backup --verbose
|
|
623
|
+
|
|
624
|
+
# list backups
|
|
625
|
+
dar-backup --list
|
|
626
|
+
|
|
627
|
+
# list contents of a dar backup
|
|
628
|
+
dar-backup --list-contents <TAB>... <choose a backup>
|
|
629
|
+
|
|
630
|
+
# see some examples on usage
|
|
631
|
+
dar-backup --examples
|
|
632
|
+
|
|
633
|
+
# see the log file
|
|
634
|
+
cat "$HOME/dar-backup/dar-backup.log"
|
|
375
635
|
```
|
|
376
636
|
|
|
377
|
-
If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option.
|
|
637
|
+
If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option.
|
|
378
638
|
|
|
379
639
|
If you want more log messages, use the `--verbose` or `--log-level debug` for even more.
|
|
380
640
|
|
|
381
|
-
If you want a backup
|
|
641
|
+
If you want to take a backup using a single backup definition, use the `-d <backup definition>` option. The backup definition's name is the filename of the definition in the BACKUP.D_DIR (see [config file](#config-file)).
|
|
382
642
|
|
|
383
643
|
```bash
|
|
384
644
|
dar-backup --full-backup -d <your backup definition>
|
|
@@ -386,7 +646,7 @@ dar-backup --full-backup -d <your backup definition>
|
|
|
386
646
|
|
|
387
647
|
### 5 - deactivate venv
|
|
388
648
|
|
|
389
|
-
Deactivate the virtual environment (venv)
|
|
649
|
+
Deactivate the virtual environment (venv).
|
|
390
650
|
|
|
391
651
|
```bash
|
|
392
652
|
deactivate
|
|
@@ -405,6 +665,9 @@ Tilde `~` and environment variables can be used in the paths for various file lo
|
|
|
405
665
|
```text
|
|
406
666
|
[MISC]
|
|
407
667
|
LOGFILE_LOCATION=~/.dar-backup.log
|
|
668
|
+
# optional parameters
|
|
669
|
+
# LOGFILE_MAX_BYTES = 26214400 # 25 MB max file size is default, change as neeeded
|
|
670
|
+
# LOGFILE_BACKUP_COUNT = 5 # 5 backup log files is default, change as needed
|
|
408
671
|
MAX_SIZE_VERIFICATION_MB = 20
|
|
409
672
|
MIN_SIZE_VERIFICATION_MB = 1
|
|
410
673
|
NO_FILES_VERIFICATION = 5
|
|
@@ -423,6 +686,8 @@ TEST_RESTORE_DIR = /tmp/dar-backup/restore/
|
|
|
423
686
|
|
|
424
687
|
[AGE]
|
|
425
688
|
# age settings are in days
|
|
689
|
+
# `cleanup` script removes archives and their .par redundancy files if older than configured.
|
|
690
|
+
# `cleanup` does not remove FULL archives, unless specifically told to and a "y" is answered to "are you sure?".
|
|
426
691
|
DIFF_AGE = 100
|
|
427
692
|
INCR_AGE = 40
|
|
428
693
|
|
|
@@ -578,6 +843,12 @@ The name of the file is the name of the backup definition.
|
|
|
578
843
|
|
|
579
844
|
You can use as many backup definitions as you need.
|
|
580
845
|
|
|
846
|
+
> Note 👉
|
|
847
|
+
>
|
|
848
|
+
> Environment variables and tilde (~) not allowed here. `dar` does not expand them.
|
|
849
|
+
>
|
|
850
|
+
> See [TODO](#todo)
|
|
851
|
+
|
|
581
852
|
```text
|
|
582
853
|
# Switch to ordered selection mode, which means that the following
|
|
583
854
|
# options will be considered top to bottom
|
|
@@ -723,20 +994,20 @@ deactivate
|
|
|
723
994
|
gives something like
|
|
724
995
|
|
|
725
996
|
```text
|
|
726
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
727
|
-
[Saved][ ] [-L-][ 93%][ ] -rw-rw-r--
|
|
728
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
729
|
-
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x
|
|
730
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
731
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
732
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
733
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
734
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
735
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
736
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
737
|
-
[Saved][ ] [-L-][ 91%][ ] -rw-rw-r--
|
|
738
|
-
[Saved][ ] [-L-][ 92%][ ] -rw-rw-r--
|
|
739
|
-
[Saved][ ] [-L-][ 91%][ ] -rw-rw-r--
|
|
997
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Sat May 10 14:15:07 2025 home/user
|
|
998
|
+
[Saved][ ] [-L-][ 93%][ ] -rw-rw-r-- user user 29 kio Fri May 9 16:45:38 2025 home/user/data/2023/2023-02-11-Udstilling-Fredericia/DSC_0568.NEF.xmp
|
|
999
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 12:49:04 2025 home/user/data/2025
|
|
1000
|
+
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x user user 193 Mio Thu May 8 15:59:17 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR
|
|
1001
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 15 Mio Thu May 8 15:52:27 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0563.NEF
|
|
1002
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 10 Mio Thu May 8 15:52:27 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0563.JPG
|
|
1003
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 9 Mio Thu May 8 15:51:53 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0559.JPG
|
|
1004
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 16 Mio Thu May 8 15:51:45 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.NEF
|
|
1005
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 12 Mio Thu May 8 15:51:45 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.JPG
|
|
1006
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 16 Mio Thu May 8 15:51:24 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.NEF
|
|
1007
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 12 Mio Thu May 8 15:51:23 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.JPG
|
|
1008
|
+
[Saved][ ] [-L-][ 91%][ ] -rw-rw-r-- user user 22 kio Thu May 8 15:59:58 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.JPG.xmp
|
|
1009
|
+
[Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- user user 30 kio Thu May 8 16:00:36 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.NEF.xmp
|
|
1010
|
+
[Saved][ ] [-L-][ 91%][ ] -rw-rw-r-- user user 22 kio Thu May 8 16:00:29 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.JPG.xmp
|
|
740
1011
|
```
|
|
741
1012
|
|
|
742
1013
|
## dar file selection examples
|
|
@@ -757,26 +1028,26 @@ This happens when the shell splits the quoted string or interprets globs before
|
|
|
757
1028
|
|
|
758
1029
|
### select a directory
|
|
759
1030
|
|
|
760
|
-
Select files and sub directories in `home/
|
|
1031
|
+
Select files and sub directories in `home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling`
|
|
761
1032
|
|
|
762
1033
|
```bash
|
|
763
|
-
dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-g 'home/
|
|
1034
|
+
dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-g 'home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling'"
|
|
764
1035
|
```
|
|
765
1036
|
|
|
766
1037
|
gives
|
|
767
1038
|
|
|
768
1039
|
```text
|
|
769
1040
|
...
|
|
770
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
771
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
772
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
773
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
774
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
775
|
-
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x
|
|
776
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
777
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
778
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
779
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1041
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 29 Mio Fri May 9 10:33:42 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0572.NEF
|
|
1042
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 28 Mio Fri May 9 10:33:12 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0571.NEF
|
|
1043
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 25 Mio Fri May 9 10:33:08 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0570.NEF
|
|
1044
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 27 Mio Fri May 9 10:32:46 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0569.NEF
|
|
1045
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 27 Mio Fri May 9 10:32:46 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0568.NEF
|
|
1046
|
+
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x user user 833 Mio Fri May 9 12:49:57 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg
|
|
1047
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 11 Mio Fri May 9 10:32:45 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0568.JPG
|
|
1048
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 11 Mio Fri May 9 10:32:46 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0569.JPG
|
|
1049
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 9 Mio Fri May 9 10:33:08 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0570.JPG
|
|
1050
|
+
[Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 13 Mio Fri May 9 10:33:12 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0571.JPG
|
|
780
1051
|
...
|
|
781
1052
|
```
|
|
782
1053
|
|
|
@@ -789,15 +1060,15 @@ dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-I '*Z50*' -
|
|
|
789
1060
|
gives something like
|
|
790
1061
|
|
|
791
1062
|
```text
|
|
792
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
793
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
794
|
-
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x
|
|
795
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
796
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
797
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
798
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
799
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
800
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1063
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Sat May 10 14:15:07 2025 home/user
|
|
1064
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 12:49:04 2025 home/user/data/2025
|
|
1065
|
+
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x user user 193 Mio Thu May 8 15:59:17 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR
|
|
1066
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 16:47:37 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling
|
|
1067
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 26 Mio Fri May 9 11:26:16 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0633.NEF
|
|
1068
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 26 Mio Fri May 9 11:26:16 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0632.NEF
|
|
1069
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 28 Mio Fri May 9 11:09:04 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0631.NEF
|
|
1070
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 29 Mio Fri May 9 11:09:03 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0630.NEF
|
|
1071
|
+
[Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 29 Mio Fri May 9 11:09:03 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0629.NEF
|
|
801
1072
|
...
|
|
802
1073
|
```
|
|
803
1074
|
|
|
@@ -828,9 +1099,9 @@ When restoring and using `/tmp` for --restore-dir, the restored files can be fou
|
|
|
828
1099
|
|
|
829
1100
|
### a single file
|
|
830
1101
|
|
|
831
|
-
```
|
|
1102
|
+
```bash
|
|
832
1103
|
. <the virtual env>/bin/activate
|
|
833
|
-
dar-backup --restore <archive_name> --selection
|
|
1104
|
+
dar-backup --restore <archive_name> --selection="-g path/to/file"
|
|
834
1105
|
deactivate
|
|
835
1106
|
```
|
|
836
1107
|
|
|
@@ -838,15 +1109,23 @@ deactivate
|
|
|
838
1109
|
|
|
839
1110
|
```bash
|
|
840
1111
|
. <the virtual env>/bin/activate
|
|
841
|
-
dar-backup --restore <archive_name> --selection
|
|
1112
|
+
dar-backup --restore <archive_name> --selection="-g path/to/directory"
|
|
842
1113
|
deactivate
|
|
843
1114
|
```
|
|
844
1115
|
|
|
845
1116
|
### .NEF from a specific date
|
|
846
1117
|
|
|
1118
|
+
The backed up directory contains \*.NEF and \*.xmp files.
|
|
1119
|
+
|
|
1120
|
+
Filtering:
|
|
1121
|
+
|
|
1122
|
+
- Include files with "2024-06-16" in file name
|
|
1123
|
+
- Exclude files with file names ending in ".xmp"
|
|
1124
|
+
- Files must be in directory "home/user/tmp/LUT-play", compared to the file root (`-R`option) in the backup.
|
|
1125
|
+
|
|
847
1126
|
```bash
|
|
848
1127
|
. <the virtual env>/bin/activate
|
|
849
|
-
dar-backup --restore <archive_name> --selection
|
|
1128
|
+
dar-backup --restore <archive_name> --selection="-I '*2024-06-16*' -X '*.xmp' -g home/user/tmp/LUT-play"
|
|
850
1129
|
deactivate
|
|
851
1130
|
```
|
|
852
1131
|
|
|
@@ -912,13 +1191,13 @@ One way to do that, is to let dar create a FULL archive from scratch, another is
|
|
|
912
1191
|
I do backups of my homedir. Here it is shown how a FULL archive is merged with a DIFF, creating a new FULL archive.
|
|
913
1192
|
|
|
914
1193
|
```bash
|
|
915
|
-
dar --merge
|
|
1194
|
+
dar --merge user-homedir_FULL_2021-09-12 -A user-homedir_FULL_2021-06-06 -@user-homedir_DIFF_2021-08-29 -s 12G
|
|
916
1195
|
|
|
917
1196
|
# test the new FULL archive
|
|
918
|
-
dar -t
|
|
1197
|
+
dar -t user-homedir_FULL_2021-09-12
|
|
919
1198
|
|
|
920
1199
|
# create Par2 redundancy files
|
|
921
|
-
for file in
|
|
1200
|
+
for file in user-homedir_FULL_yyyy-mm-dd.*.dar; do
|
|
922
1201
|
par2 c -r5 -n1 "$file"
|
|
923
1202
|
done
|
|
924
1203
|
```
|
|
@@ -943,6 +1222,8 @@ These [.darrc](#darrc) settings make `dar` print the current directory being pro
|
|
|
943
1222
|
|
|
944
1223
|
This is very useful in very long running jobs to get an indication that the backup is proceeding normally.
|
|
945
1224
|
|
|
1225
|
+
The `dar` output is streamed to the `dar-backup-commands.log` file.
|
|
1226
|
+
|
|
946
1227
|
### Separate log file for command output
|
|
947
1228
|
|
|
948
1229
|
Dar-backup's log file is called `dar-backup.log`.
|
|
@@ -1053,8 +1334,8 @@ Try auto completion in your session:
|
|
|
1053
1334
|
eval "$(register-python-argcomplete dar-backup)"
|
|
1054
1335
|
eval "$(register-python-argcomplete cleanup)"
|
|
1055
1336
|
eval "$(register-python-argcomplete manager)"
|
|
1056
|
-
complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
1057
|
-
complete -o nosort -C 'python -m argcomplete manager' manager
|
|
1337
|
+
#complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
1338
|
+
#complete -o nosort -C 'python -m argcomplete manager' manager
|
|
1058
1339
|
```
|
|
1059
1340
|
|
|
1060
1341
|
To make it persistent across sessions, add this to your ~/.bashrc:
|
|
@@ -1065,8 +1346,8 @@ eval "$(register-python-argcomplete dar-backup)"
|
|
|
1065
1346
|
eval "$(register-python-argcomplete cleanup)"
|
|
1066
1347
|
eval "$(register-python-argcomplete manager)"
|
|
1067
1348
|
# This disables bash sorting, so sorting is by <backup definition> and <date>
|
|
1068
|
-
complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
1069
|
-
complete -o nosort -C 'python -m argcomplete manager' manager
|
|
1349
|
+
#complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
1350
|
+
#complete -o nosort -C 'python -m argcomplete manager' manager
|
|
1070
1351
|
```
|
|
1071
1352
|
|
|
1072
1353
|
If you're using a virtual environment and register-python-argcomplete isn't in your global PATH, use:
|
|
@@ -1104,8 +1385,54 @@ Then reload Zsh:
|
|
|
1104
1385
|
source ~/.zshrc
|
|
1105
1386
|
```
|
|
1106
1387
|
|
|
1388
|
+
## Easy development setup
|
|
1389
|
+
|
|
1390
|
+
It is very easy to have your own development environment.
|
|
1391
|
+
|
|
1392
|
+
```bash
|
|
1393
|
+
git clone https://github.com/per2jensen/dar-backup.git
|
|
1394
|
+
cd dar-backup/v2
|
|
1395
|
+
./build.py
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
This script:
|
|
1399
|
+
|
|
1400
|
+
- Creates a Python virtual environment called `venv`
|
|
1401
|
+
- pip install `hatch`
|
|
1402
|
+
- pip install the development environment as setup in pyproject.toml
|
|
1403
|
+
|
|
1404
|
+
--
|
|
1405
|
+
|
|
1406
|
+
```text
|
|
1407
|
+
dev = [
|
|
1408
|
+
"pytest",
|
|
1409
|
+
"wheel>=0.45.1",
|
|
1410
|
+
"requests>=2.32.2",
|
|
1411
|
+
"coverage>=7.8.2",
|
|
1412
|
+
"pytest>=8.4.0",
|
|
1413
|
+
"pytest-cov>=6.1.1",
|
|
1414
|
+
"psutil>=7.0.0",
|
|
1415
|
+
"pytest-timeout>=2.4.0",
|
|
1416
|
+
"httpcore>=0.17.3",
|
|
1417
|
+
"h11>=0.16.0",
|
|
1418
|
+
"zipp>=3.19.1",
|
|
1419
|
+
"anyio>=4.4.0",
|
|
1420
|
+
"black>=25.1.0"]
|
|
1421
|
+
```
|
|
1422
|
+
|
|
1423
|
+
✅ Your environment is now ready to activate and test!
|
|
1424
|
+
|
|
1425
|
+
Activate and run the test suite:
|
|
1426
|
+
|
|
1427
|
+
```bash
|
|
1428
|
+
source venv/bin/activate # activate the virtual env
|
|
1429
|
+
pytest # run the test suite
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1107
1432
|
## Todo
|
|
1108
1433
|
|
|
1434
|
+
- Perhaps look into pre-processing backup definitions. As `dar` does not expand env vars
|
|
1435
|
+
`dar-backup` could do so and feed the result to `dar`.
|
|
1109
1436
|
- When run interactively, a progress bar during test and par2 generation would be nice.
|
|
1110
1437
|
- Look into a way to move the .par2 files away from the `dar` slices, to maximize chance of good redundancy.
|
|
1111
1438
|
- Add option to dar-backup to use the `dar` option `--fsa-scope none`
|
|
@@ -1139,7 +1466,7 @@ One backup definition per file
|
|
|
1139
1466
|
| [clean-log](#clean-log-options) | Clean up excessive log output from dar command logs |
|
|
1140
1467
|
| [dar-backup-systemd](#dar-backup-systemd-options) | Generate (and optionally install) systemd timers and services for automated backups |
|
|
1141
1468
|
| [installer](#installer-options) | Set up directories and optionally create catalog databases according to a config file |
|
|
1142
|
-
| [demo](#demo-options) | Set up required directories and
|
|
1469
|
+
| [demo](#demo-options) | Set up required directories and config files for a demo|
|
|
1143
1470
|
|
|
1144
1471
|
### test coverage
|
|
1145
1472
|
|
|
@@ -1270,10 +1597,12 @@ Sets up `dar-backup` according to provided config file.
|
|
|
1270
1597
|
The installer creates the necessary backup catalog databases if `--create-db` is given.
|
|
1271
1598
|
|
|
1272
1599
|
```bash
|
|
1273
|
-
--config
|
|
1274
|
-
--create-db
|
|
1275
|
-
-
|
|
1276
|
-
-
|
|
1600
|
+
--config Path to a config file. The configured directories will be created.
|
|
1601
|
+
--create-db Create backup catalog databases. Use this option with `--config`.
|
|
1602
|
+
--install-autocompletion Add bash or zsh auto completion - idempotent.
|
|
1603
|
+
--remove-autocompletion Remove the auto completion from bash or zsh.
|
|
1604
|
+
-v, --version Display version and licensing information.
|
|
1605
|
+
-h, --help Displays usage info.
|
|
1277
1606
|
```
|
|
1278
1607
|
|
|
1279
1608
|
### Demo options
|
|
@@ -1293,10 +1622,17 @@ Create directories:
|
|
|
1293
1622
|
Sets up demo config files:
|
|
1294
1623
|
|
|
1295
1624
|
- ~/.config/dar-backup/dar-backup.conf
|
|
1296
|
-
- ~/.config/dar-backup/backup.d/
|
|
1625
|
+
- ~/.config/dar-backup/backup.d/demo
|
|
1297
1626
|
|
|
1298
1627
|
```bash
|
|
1299
|
-
-i, --install
|
|
1300
|
-
-
|
|
1301
|
-
-
|
|
1628
|
+
-i, --install Sets up `dar-backup`.
|
|
1629
|
+
--root-dir Specify the root directory for the backup.
|
|
1630
|
+
--dir-to-backup Directory to backup, relative to the root directory.
|
|
1631
|
+
--backup-dir Directory where backups and redundancy files are put.
|
|
1632
|
+
--override By default, the script will not overwrite existing files or directories.
|
|
1633
|
+
Use this option to override this behavior.
|
|
1634
|
+
--generate Generate config files and put them in /tmp/ for inspection
|
|
1635
|
+
without writing to $HOME.
|
|
1636
|
+
-v, --version Display version and licensing information.
|
|
1637
|
+
-h, --help Displays usage info
|
|
1302
1638
|
```
|