dar-backup 0.6.17__py3-none-any.whl → 0.6.18__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/README.md ADDED
@@ -0,0 +1,1082 @@
1
+ <!-- markdownlint-disable MD024 -->
2
+ # Full, differential or incremental backups using 'dar'
3
+
4
+ [![codecov](https://codecov.io/gh/per2jensen/dar-backup/branch/main/graph/badge.svg)](https://codecov.io/gh/per2jensen/dar-backup)
5
+
6
+ The wonderful 'dar' [Disk Archiver](https://github.com/Edrusb/DAR) is used for
7
+ the heavy lifting, together with the par2 suite in these scripts.
8
+
9
+ This is the `Python` based **version 2** of `dar-backup`.
10
+
11
+ ## Table of Contents
12
+
13
+ - [Full, differential or incremental backups using 'dar'](#full-differential-or-incremental-backups-using-dar)
14
+ - [My use case](#my-use-case)
15
+ - [License](#license)
16
+ - [Status](#status)
17
+ - [GPG Signing key](#gpg-signing-key)
18
+ - [Breaking change in version 0.6.0](#breaking-change-in-version-060)
19
+ - [Homepage - Github](#homepage---github)
20
+ - [Requirements](#requirements)
21
+ - [Principles](#dar-backup-principles)
22
+ - [How to run](#how-to-run)
23
+ - [1 - installation](#1---installation)
24
+ - [2 - configuration](#2---configuration)
25
+ - [3 - generate catalog databases](#3---generate-catalog-databases)
26
+ - [4 - do FULL backups](#4---do-full-backups)
27
+ - [5 - deactivate venv](#5---deactivate-venv)
28
+ - [Config](#config)
29
+ - [Config file](#config-file)
30
+ - [.darrc](#darrc)
31
+ - [Backup definition](#backup-definition-example)
32
+ - [Systemd examples](#systemctl-examples)
33
+ - [Generate systemd files](#generate-systemd-files)
34
+ - [Service: dar-back --incremental-backup](#service-dar-backup---incremental-backup)
35
+ - [Timer: dar-back --incremental-backup](#timer-dar-backup---incremental-backup)
36
+ - [List contents of an archive](#list-contents-of-an-archive)
37
+ - [dar file selection examples](#dar-file-selection-examples)
38
+ - [Select a directory](#select-a-directory)
39
+ - [Select file dates in the directory](#select-file-dates-in-the-directory)
40
+ - [Exclude .xmp files from that date](#exclude-xmp-files-from-that-date)
41
+ - [Restoring](#restoring)
42
+ - [Default location for restores](#default-location-for-restores)
43
+ - [--restore-dir option](#--restore-dir-option)
44
+ - [A single file](#a-single-file)
45
+ - [A directory](#a-directory)
46
+ - [.NEF from a specific date](#nef-from-a-specific-date)
47
+ - [Restore test fails with exit code 4](#restore-test-fails-with-exit-code-4)
48
+ - [Restore test fails with exit code 5](#restore-test-fails-with-exit-code-5)
49
+ - [Par2](#par2)
50
+ - [Par2 to verify/repair](#par2-to-verifyrepair)
51
+ - [Par2 create redundancy files](#par2-create-redundancy-files)
52
+ - [Points of interest](#points-of-interest)
53
+ - [Merge FULL with DIFF, creating new FULL](#merge-full-with-diff-creating-new-full)
54
+ - [dar manager databases](#dar-manager-databases)
55
+ - [Performance tip due to par2](#performance-tip-due-to-par2)
56
+ - [.darrc sets -vd -vf (since v0.6.4)](#darrc-sets--vd--vf-since-v064)
57
+ - [Separate log file for command output](#separate-log-file-for-command-output)
58
+ - [Skipping cache directories](#skipping-cache-directories)
59
+ - [Progress bar + current directory](#progress-bar-and-current-directory)
60
+ - [Todo](#todo)
61
+ - [Reference](#reference)
62
+ - [Test coverage report](#test-coverage)
63
+ - [dar-backup](#dar-backup-options)
64
+ - [manager](#manager-options)
65
+ - [cleanup](#cleanup-options)
66
+ - [clean-log](#clean-log-options)
67
+ - [installer](#installer-options)
68
+ - [dar-backup-systemd](#dar-backup-systemd)
69
+
70
+ ## My use case
71
+
72
+ 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
73
+
74
+ - a non-privileged user can perform a mount
75
+ - a privileged user cannot look into the filesystem --> a backup script running as root is not suitable
76
+
77
+ I needed the following:
78
+
79
+ - Backup my cloud storage to something local (cloud is convenient, but I want control over my backups)
80
+ - Backup primarily photos, video and different types of documents
81
+ - Have a simple non-complicated 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.
82
+ - During backup archives must be tested and a restore test (however small) performed
83
+ - Archives stored on a server with a reliable file system (easy to mount a directory over sshfs)
84
+ - Easy to verify archive's integrity, after being moved around.
85
+
86
+ I do not need the encryption features of dar, as all storage is already encrypted.
87
+
88
+ ## License
89
+
90
+ These scripts are licensed under the GPLv3 license.
91
+ Read more here: [GNU CPL 3.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.
92
+
93
+ ## Status
94
+
95
+ As of August 8, 2024 I am using the alpha versions of `dar-backup` (alpha-0.5.9 onwards) in my automated backup routine.
96
+
97
+ As of February 13, 2025, I have changed the status from alpha --> beta, as the featureset is in place and the alphas have worked well for a very long time.
98
+
99
+ ### GPG Signing key
100
+
101
+ To increase the security and authenticity of dar-backup packages, all releases from v2-beta-0.6.18 onwards will be digitally signed using the GPG key below.
102
+
103
+ 🔐 GPG Signing Key Details
104
+
105
+ ```` text
106
+ Name: Per Jensen (author of dar-backup)
107
+ Email: dar-backup@pm.me
108
+ Primary key: 4592 D739 6DBA EFFD 0845 02B8 5CCE C7E1 6814 A36E
109
+ Signing key: B54F 5682 F28D BA36 22D7 8E04 58DB FADB BBAC 1BB1
110
+ Created: 2025-03-29
111
+ Expires: 2030-03-28
112
+ Key type: ed25519 (primary, SC)
113
+ Subkeys: ed25519 (S), ed25519 (A), cv25519 (E)
114
+ ````
115
+
116
+ 🔏 Where to Find Release Signatures
117
+
118
+ PyPI does *Not* host .asc Signature Files
119
+
120
+ Although the `dar-backup` packages on PyPI are GPG-signed, PyPI itself does **not support uploading** .asc detached signature files alongside `.whl` and `.tar.gz` artifacts.
121
+
122
+ Therefore, you will not find `.asc` files on PyPI.
123
+
124
+ ✅ Where to Get `.asc` Signature Files
125
+
126
+ You can always download the signed release artifacts and their `.asc` files from the official GitHub Releases page:
127
+
128
+ 📁 GitHub Releases for `dar-backup`
129
+
130
+ Each release includes:
131
+
132
+ - `dar_backup-x.y.z.tar.gz`
133
+
134
+ - `dar_backup-x.y.z.tar.gz.asc`
135
+
136
+ - `dar_backup-x.y.z-py3-none-any.whl`
137
+
138
+ - `dar_backup-x.y.z-py3-none-any.whl.asc`
139
+
140
+ 🔐 How to Verify a Release from GitHub
141
+
142
+ 1. Import the GPG public key:
143
+
144
+ ```` bash
145
+ curl https://keys.openpgp.org/vks/v1/by-fingerprint/4592D7396DBAEFFD084502B85CCEC7E16814A36E | gpg --import
146
+ ````
147
+
148
+ 2. Download the wheel or tarball and its .asc signature from the GitHub.
149
+
150
+ 3. Run GPG to verify it:
151
+
152
+ ```` bash
153
+ gpg --verify dar_backup-x.y.z.tar.gz.asc dar_backup-x.y.z.tar.gz
154
+ # or
155
+ gpg --verify dar_backup-x.y.z-py3-none-any.whl.asc dar_backup-x.y.z-py3-none-any.whl
156
+ ````
157
+
158
+ 4. If the signature is valid, you'll see:
159
+
160
+ ```` text
161
+ gpg: Good signature from "Per Jensen (author of dar-backup) <dar-backup@pm.me>"
162
+ ````
163
+
164
+ 🛡️ Reminder: Verify the signing subkey
165
+
166
+ Only this subkey is used to sign PyPI packages:
167
+
168
+ ```` text
169
+ B54F 5682 F28D BA36 22D7 8E04 58DB FADB BBAC 1BB1
170
+ ````
171
+
172
+ You can view it with:
173
+
174
+ ```` bash
175
+ gpg --list-keys --with-subkey-fingerprints dar-backup@pm.me
176
+ ````
177
+
178
+ ### Breaking change in version 0.6.0
179
+
180
+ Version 0.6.0 and forwards requires the config variable *COMMAND_TIMEOUT_SECS* in the config file.
181
+
182
+ ## Homepage - Github
183
+
184
+ 'dar-backup' package lives here: [Github - dar-backup](https://github.com/per2jensen/dar-backup/tree/main/v2)
185
+
186
+ This python version is v2 of dar-backup, v1 is made in bash.
187
+
188
+ ## Requirements
189
+
190
+ - dar
191
+ - par2
192
+ - python3
193
+
194
+ On Ubuntu, install the requirements this way:
195
+
196
+ ```` bash
197
+ sudo apt install dar par2 python3
198
+ ````
199
+
200
+ ## dar-backup principles
201
+
202
+ ### dar-backup
203
+
204
+ `dar-backup` is built in a way that emphasizes getting backups. It loops over the [backup definitions](#backup-definition-example), and in the event of a failure while backing up a backup definition, dar-backup shall log an error and start working on the next backup definition.
205
+
206
+ There are 3 levels of backups, FULL, DIFF and INCR.
207
+
208
+ - The author does a FULL yearly backup once a year. This includes all files in all directories as defined in the backup definition(s) (assuming `-d` was not given).
209
+ - The author makes a DIFF once a month. The DIFF backs up new and changed files **compared** to the **FULL** backup.
210
+
211
+ - No DIFF backups are taken until a FULL backup has been taken for a particular backup definition.
212
+
213
+ - The author takes an INCR backup every 3 days. An INCR backup includes new and changed files **compared** to the **DIFF** backup.
214
+
215
+ - So, a set of INCR's will contain duplicates (this might change as I become more used to use the catalog databases)
216
+
217
+ - No INCR backups are taken until a DIFF backup has been taken for a particular backup definition.
218
+
219
+ After each backup of a backup definition, `dar-backup` tests the archive and then performs a few restore operations of random files from the archive (see [dar-backup.conf](#config-file)). The restored files are compared to the originals to check if the restore went well.
220
+
221
+ `dar-backup` skips doing a backup of a backup definition if an archive is already in place. So, if you for some reason need to take a new backup on the same date, the first archive must be deleted (I recommend using [cleanup](#cleanup-1)).
222
+
223
+ ### cleanup
224
+
225
+ The `cleanup` application deletes DIFF and INCR if the archives are older than the thresholds set up in the configuration file.
226
+
227
+ `cleanup` will only remove FULL archives if the option `--cleanup-specific-archives` is used. It requires the user to confirm deletion of FULL archives.
228
+
229
+ ### manager
230
+
231
+ `dar`has the concept of catalogs which can be exported and optionally be added to a catalog database. That database makes it much easier to restore the correct version of a backed up file if for example a target date has been set.
232
+
233
+ `dar-backup` adds archive catalogs to their databases (using the `manager` script). Should the operation fail, `dar-backup` logs an error and continue with testing and restore validation tests.
234
+
235
+ ## How to run
236
+
237
+ 📦 All official dar-backup releases from v2-beta-0.6.18 are signed with GPG.
238
+
239
+ See more [here](#gpg-signing-key).
240
+
241
+ ### 1 - installation
242
+
243
+ Installation is currently in a venv. These commands are installed in the venv:
244
+
245
+ - dar-back
246
+ - cleanup
247
+ - manager
248
+ - clean-log
249
+ - installer
250
+
251
+ Note:
252
+
253
+ The module `inputimeout` is installed into the venv and used for the confirmation input (with a 30 second timeout)
254
+
255
+ To install, create a venv and run pip:
256
+
257
+ ```` bash
258
+ mkdir $HOME/tmp
259
+ cd $HOME/tmp
260
+ python3 -m venv venv # create the virtual environment
261
+ . venv/bin/activate # activate the virtual env
262
+ pip install dar-backup # run pip to install `dar-backup`
263
+ ````
264
+
265
+ I have an alias in ~/.bashrc pointing to my venv:
266
+
267
+ ```` bash
268
+ alias db=". ~/tmp/venv/bin/activate; dar-backup -v"
269
+ ````
270
+
271
+ Typing `db` at the command line gives this
272
+
273
+ ```` bash
274
+ (venv) user@machine:~$ db
275
+ dar-backup 0.6.12
276
+ dar-backup.py source code is here: https://github.com/per2jensen/dar-backup
277
+ Licensed under GNU GENERAL PUBLIC LICENSE v3, see the supplied file "LICENSE" for details.
278
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
279
+ See section 15 and section 16 in the supplied "LICENSE" file.
280
+ ````
281
+
282
+ ### 2 - configuration
283
+
284
+ The dar-backup installer is non-destructive and stops if some of the default directories exist.
285
+
286
+ Run the installer
287
+
288
+ ```` bash
289
+ installer --install
290
+ ````
291
+
292
+ The output is
293
+
294
+ ```` text
295
+ Directories created: `/home/user/dar-backup/` and `/home/user/.config/dar-backup`
296
+ Config file deployed to /home/user/.config/dar-backup/dar-backup.conf
297
+ Default backup definition deployed to /home/user/.config/dar-backup/backup.d/default
298
+ 1. Now run `manager --create-db` to create the catalog database.
299
+ 2. Then you can run `dar-backup --full-backup` to create a backup.
300
+ 3. List backups with `dar-backup --list`
301
+ 4. List contents of a backup with `dar-backup --list-contents <backup-name>`
302
+ ````
303
+
304
+ ### 3 - generate catalog databases
305
+
306
+ Generate the archive catalog database(s).
307
+
308
+ `dar-backup` expects the catalog databases to be in place, it does not automatically create them (by design)
309
+
310
+ ```` bash
311
+ manager --create-db
312
+ ````
313
+
314
+ ### 4 - do FULL backups
315
+
316
+ Prereq:
317
+ [Backup definitions](#backup-definition-example) are in place in BACKUP.D_DIR (see [config file](#config-file)).
318
+
319
+ You are ready to do backups of all your backup definitions.
320
+
321
+ ```` bash
322
+ dar-backup --full-backup
323
+ ````
324
+
325
+ If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option. This can be useful if dar-backup is started by systemd.
326
+
327
+ If you want more log messages, use the `--verbose` or `--log-level debug` for even more.
328
+
329
+ If you want a backup of a single definition, use the `-d <backup definition>` option. The definition's name is the filename of the definition in the `backup.d` config directory.
330
+
331
+ ```` bash
332
+ dar-backup --full-backup -d <your backup definition>
333
+ ````
334
+
335
+ ### 5 - deactivate venv
336
+
337
+ Deactivate the virtual environment (venv)
338
+
339
+ ```` bash
340
+ deactivate
341
+ ````
342
+
343
+ ## Config
344
+
345
+ ### Config file
346
+
347
+ The configuration file's default location is: ~/.config/dar-backup/dar-backup.conf
348
+
349
+ If you have your config file somewhere else, use the `--config` option to point to it.
350
+
351
+ Tilde `~` and environment variables can be used in the paths for various file locations.
352
+
353
+ ```` code
354
+ [MISC]
355
+ LOGFILE_LOCATION=~/.dar-backup.log
356
+ MAX_SIZE_VERIFICATION_MB = 20
357
+ MIN_SIZE_VERIFICATION_MB = 1
358
+ NO_FILES_VERIFICATION = 5
359
+ # timeout in seconds for backup, test, restore and par2 operations
360
+ # The author has such `dar` tasks running for 10-15 hours on the yearly backups, so a value of 24 hours is used.
361
+ # If a timeout is not specified when using the util.run_command(), a default timeout of 30 secs is used.
362
+ COMMAND_TIMEOUT_SECS = 86400
363
+
364
+ [DIRECTORIES]
365
+ BACKUP_DIR = /some/where/dar-backup/backups/
366
+ BACKUP.D_DIR = /some/where/dar-backup/backup.d
367
+ TEST_RESTORE_DIR = /tmp/dar-backup/restore/
368
+
369
+ [AGE]
370
+ # age settings are in days
371
+ DIFF_AGE = 100
372
+ INCR_AGE = 40
373
+
374
+ [PAR2]
375
+ ERROR_CORRECTION_PERCENT = 5
376
+ ENABLED = True
377
+
378
+ # scripts to run before the backup to setup the environment
379
+ [PREREQ]
380
+ SCRIPT_1 = ls -l /tmp
381
+ #SCRIPT_2 = another_script.sh
382
+
383
+ [POSTREQ]
384
+ SCRIPT_1 = df -h
385
+ #SCRIPT_2 = another_script.sh
386
+ ````
387
+
388
+ ### .darrc
389
+
390
+ The package includes a default `darrc` file which configures `dar`.
391
+
392
+ You can override the default `.darrc` using the `--darrc` option.
393
+
394
+ The default `.darrc` contents are as follows:
395
+
396
+ ```` code
397
+ # .darrc configuration file for `dar` as used by the `dar-backup` script.
398
+ # `dar-backup` lives here: https://github.com/per2jensen/dar-backup
399
+
400
+
401
+ ##############################################################
402
+
403
+ # target: verbose
404
+
405
+ # remove comments belov for dar being more verbose
406
+
407
+ verbose:
408
+
409
+ # shows files teated due to filtering inclusion or no filtering at all
410
+
411
+ # -vt
412
+
413
+ # shows skipped files du to exclusion
414
+
415
+ # -vs
416
+
417
+ # shows diretory currently being processed
418
+ # dar-backup logs `dar` stdout in real time, so directories being processed are now shown in the log file.
419
+ # this is quite useful in long running jobs
420
+ -vd
421
+
422
+ # shows detailed messages, not related to files and directories
423
+ # -vm
424
+
425
+ # shows summary of each treated directory, including average compression
426
+ # dar-backup logs `dar` stdout in real time, so directories being processed are now shown in the log file.
427
+ # this is quite useful in long running jobs
428
+ -vf
429
+
430
+ # equivalent to "-vm -vs -vt"
431
+ # -va
432
+
433
+
434
+ restore-options:
435
+ # don't restore File Specific Attributes
436
+ #--fsa-scope none
437
+
438
+ # ignore owner, useful when used by a non-privileged user
439
+ --comparison-field=ignore-owner
440
+
441
+
442
+ # Exclude specific file types from compression
443
+ compress-exclusion:
444
+
445
+ # First setting case insensitive mode on:
446
+ -an
447
+ -ag
448
+
449
+ -Z "*.gz"
450
+ -Z "*.bz2"
451
+ -Z "*.xz"
452
+ -Z "*.zip"
453
+ -Z "*.rar"
454
+ -Z "*.7z"
455
+ -Z "*.tar"
456
+ -Z "*.tgz"
457
+ -Z "*.tbz2"
458
+ -Z "*.txz"
459
+ # Exclude common image file types from compression
460
+ -Z "*.jpg"
461
+ -Z "*.jpeg"
462
+ -Z "*.png"
463
+ -Z "*.gif"
464
+ -Z "*.bmp"
465
+ -Z "*.tiff"
466
+ -Z "*.svg"
467
+ -Z "*.ico"
468
+ -Z "*.webp"
469
+ # The author uses Nikon compressed NEFs raw files
470
+ -Z "*.NEF"
471
+ # Exclude common movie file types from compression
472
+ -Z "*.mp4"
473
+ -Z "*.avi"
474
+ -Z "*.mkv"
475
+ -Z "*.mov"
476
+ -Z "*.wmv"
477
+ -Z "*.flv"
478
+ -Z "*.mpeg"
479
+ -Z "*.mpg"
480
+
481
+ # These are zip files. Not all are compressed, but considering that they can
482
+ # get quite large it is probably more prudent to leave this uncommented.
483
+ -Z "*.pk3"
484
+ -Z "*.zip"
485
+
486
+ -Z "*.lz4"
487
+ -Z "*.zoo"
488
+
489
+ -Z "*.Po"
490
+ -Z "*.aar"
491
+ -Z "*.bx"
492
+ -Z "*.chm"
493
+ -Z "*.doc"
494
+ -Z "*.epub"
495
+ -Z "*.f3d"
496
+ -Z "*.gpg"
497
+ -Z "*.htmlz"
498
+ -Z "*.iix"
499
+ -Z "*.iso"
500
+ -Z "*.jin"
501
+ -Z "*.ods"
502
+ -Z "*.odt"
503
+ -Z "*.ser"
504
+ -Z "*.svgz"
505
+ -Z "*.swx"
506
+ -Z "*.sxi"
507
+ -Z "*.whl"
508
+ -Z "*.wings"
509
+
510
+
511
+ # Dar archives (may be compressed).
512
+ -Z "*.dar"
513
+
514
+ # Now we swap back to case sensitive mode for masks which is the default
515
+ #mode:
516
+ -acase
517
+ ````
518
+
519
+ ### Backup definition example
520
+
521
+ This piece of configuration is a [backup definition](#backup-definition-example). It is placed in the BACKUP.D_DIR (see config file description).
522
+ The name of the file is the name of the backup definition.
523
+
524
+ You can use as many backup definitions as you need.
525
+
526
+ ```` code
527
+ # Switch to ordered selection mode, which means that the following
528
+ # options will be considered top to bottom
529
+ -am
530
+
531
+ # Backup Root Dir
532
+ # This is the top directory, where the backups start.
533
+ #Directories mentioned below, are relative to the Root Dir.
534
+ -R /home/user/
535
+
536
+ # Directories to backup below the Root dir
537
+ # uncomment the next line to backup only the Documents directory
538
+ # -g Documents
539
+
540
+ # Directories to exclude below the Root dir
541
+ -P mnt
542
+ -P tmp
543
+ -P .cache
544
+ -P .config/Code/CachedData
545
+
546
+ # compression level
547
+ -z5
548
+
549
+ # no overwrite, if you rerun a backup, 'dar' halts and asks what to do
550
+ # due to the -Q option given to `dar`, the program will terminate and give en error.
551
+ -n
552
+
553
+ # size of each slice in the archive
554
+ --slice 7G
555
+
556
+ # bypass directores marked as cache directories
557
+ # http://dar.linux.free.fr/doc/Features.html
558
+ # https://bford.info/cachedir/
559
+ --cache-directory-tagging
560
+ ````
561
+
562
+ ## Generate systemd files
563
+
564
+ The command `dar-backup-systemd` can generate and optionally install systemd units and timers.
565
+
566
+ The timers are set as the author uses them, modify to your taste and needs.
567
+
568
+ Example run:
569
+
570
+ ```` bash
571
+ dar-backup-systemd --venv /home/user/tmp/venv --dar-path /home/user/.local/dar/bin
572
+ Generated dar-full-backup.service and dar-full-backup.timer
573
+ → Fires on: *-12-30 10:03:00
574
+ Generated dar-diff-backup.service and dar-diff-backup.timer
575
+ → Fires on: *-*-01 19:03:00
576
+ Generated dar-incr-backup.service and dar-incr-backup.timer
577
+ → Fires on: *-*-04/3 19:03:00
578
+ Generated dar-clean.service and dar-clean.timer
579
+ → Fires on: *-*-* 21:07:00
580
+ ````
581
+
582
+ ## Systemctl examples
583
+
584
+ I have dar-backup scheduled to run via systemd --user settings.
585
+
586
+ The files are located in: ~/.config/systemd/user
587
+
588
+ Once the .service and .timer files are in place, timers must be enabled and started.
589
+
590
+ ```` bash
591
+ systemctl --user enable dar-inc-backup.timer
592
+ systemctl --user start dar-inc-backup.timer
593
+ systemctl --user daemon-reload
594
+ ````
595
+
596
+ Verify your timers are set up as you want:
597
+
598
+ ```` bash
599
+ systemctl --user list-timers
600
+ ````
601
+
602
+ ## Service: dar-backup --incremental-backup
603
+
604
+ This is an exmaple of a systemd user service unit.
605
+
606
+ File: dar-incr-backup.service
607
+
608
+ ```` bash
609
+ /tmp/test$ dar-backup-systemd --venv '$HOME/programmer/dar-backup.py/venv' --dar-path '$HOME/.local/dar/bin'
610
+
611
+ Generated dar-full-backup.service and dar-full-backup.timer
612
+ → Fires on: *-12-30 10:03:00
613
+ Generated dar-diff-backup.service and dar-diff-backup.timer
614
+ → Fires on: *-*-01 19:03:00
615
+ Generated dar-incr-backup.service and dar-incr-backup.timer
616
+ → Fires on: *-*-04/3 19:03:00
617
+ Generated dar-cleanup.service and dar-cleanup.timer
618
+ → Fires on: *-*-* 21:07:00
619
+ /tmp/test$
620
+ (venv) /tmp/test$
621
+ (venv) /tmp/test$ cat dar-incr-backup.service
622
+ [Unit]
623
+ Description=dar-backup INCR
624
+ StartLimitIntervalSec=120
625
+ StartLimitBurst=1
626
+
627
+ [Service]
628
+ Type=oneshot
629
+ TimeoutSec=infinity
630
+ RemainAfterExit=no
631
+
632
+
633
+ ExecStart=/bin/bash -c 'PATH=$HOME/.local/dar/bin:$PATH && . $HOME/programmer/dar-backup.py/venv/bin/activate && dar-backup -I --verbose --log-stdout'
634
+ ````
635
+
636
+ ## Timer: dar-backup --incremental-backup
637
+
638
+ This is an example of a systemd user timer
639
+
640
+ File: dar-incr-backup.timer
641
+
642
+ ```` code
643
+ [Unit]
644
+ Description=dar-backup INCR timer
645
+
646
+ [Timer]
647
+ OnCalendar=*-*-04/3 19:03:00
648
+ Persistent=true
649
+
650
+ [Install]
651
+ WantedBy=timers.target
652
+ ````
653
+
654
+ ## list contents of an archive
655
+
656
+ ```` bash
657
+ . <the virtual evn>/bin/activate
658
+ dar-backup --list-contents example_FULL_2024-06-23 --selection "-X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play"
659
+ deactivate
660
+ ````
661
+
662
+ gives
663
+
664
+ ``` code
665
+ [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
666
+ --------------------------------+------------+-------+-------+---------+-------------------------------+------------
667
+ [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
668
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
669
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
670
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
671
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
672
+ ```
673
+
674
+ ## dar file selection examples
675
+
676
+ ### select a directory
677
+
678
+ ``` bash
679
+ dar -l /tmp/example_FULL_2024-06-23 -g home/pj/tmp/LUT-play
680
+ ```
681
+
682
+ gives
683
+
684
+ ```` code
685
+ [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
686
+ --------------------------------+------------+-------+-------+---------+-------------------------------+------------
687
+ [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
688
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
689
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
690
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
691
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
692
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 48 kio Sat Jun 22 21:51:24 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF.xmp
693
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 50 kio Sat Jun 22 21:51:25 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_01.NEF.xmp
694
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:26 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_02.NEF.xmp
695
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_03.NEF.xmp
696
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_04.NEF.xmp
697
+ [Saved][ ] [-L-][ 97%][ ] -rw-rw-r-- pj pj 77 kio Sat Jun 22 21:50:16 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_05.NEF.xmp
698
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 52 kio Sat Jun 22 21:49:37 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_06.NEF.xmp
699
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:47 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_07.NEF.xmp
700
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_08.NEF.xmp
701
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_09.NEF.xmp
702
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:39 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_10.NEF.xmp
703
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:36 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_11.NEF.xmp
704
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:35 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_12.NEF.xmp
705
+ [Saved][ ] [-L-][ 88%][ ] -rw-rw-r-- pj pj 15 kio Sat Jun 22 21:51:11 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_13.NEF.xmp
706
+ [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 84 kio Sat Jun 22 21:51:09 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_14.NEF.xmp
707
+ [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 90 kio Sat Jun 22 21:51:04 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_15.NEF.xmp
708
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:15 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_16.NEF.xmp
709
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:48 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_17.NEF.xmp
710
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:19 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_18.NEF.xmp
711
+ ````
712
+
713
+ ### select file dates in the directory
714
+
715
+ ``` bash
716
+ dar -l /tmp/example_FULL_2024-06-23 -I '*2024-06-16*' -g home/pj/tmp/LUT-play
717
+ ```
718
+
719
+ gives
720
+
721
+ ``` code
722
+ [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
723
+ --------------------------------+------------+-------+-------+---------+-------------------------------+------------
724
+ [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
725
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
726
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
727
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Sed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
728
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
729
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 48 kio Sat Jun 22 21:51:24 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF.xmp
730
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 50 kio Sat Jun 22 21:51:25 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_01.NEF.xmp
731
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:26 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_02.NEF.xmp
732
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_03.NEF.xmp
733
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_04.NEF.xmp
734
+ [Saved][ ] [-L-][ 97%][ ] -rw-rw-r-- pj pj 77 kio Sat Jun 22 21:50:16 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_05.NEF.xmp
735
+ [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 52 kio Sat Jun 22 21:49:37 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_06.NEF.xmp
736
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:47 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_07.NEF.xmp
737
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_08.NEF.xmp
738
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_09.NEF.xmp
739
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:39 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_10.NEF.xmp
740
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:36 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_11.NEF.xmp
741
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:35 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_12.NEF.xmp
742
+ [Saved][ ] [-L-][ 88%][ ] -rw-rw-r-- pj pj 15 kio Sat Jun 22 21:51:11 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_13.NEF.xmp
743
+ [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 84 kio Sat Jun 22 21:51:09 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_14.NEF.xmp
744
+ [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 90 kio Sat Jun 22 21:51:04 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_15.NEF.xmp
745
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:15 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_16.NEF.xmp
746
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:48 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_17.NEF.xmp
747
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:19 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_18.NEF.xmp
748
+ ```
749
+
750
+ ### exclude .xmp files from that date
751
+
752
+ ``` bash
753
+ dar -l /tmp/example_FULL_2024-06-23 -X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play
754
+
755
+ ```
756
+
757
+ gives
758
+
759
+ ```` code
760
+ [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
761
+ --------------------------------+------------+-------+-------+---------+-------------------------------+------------
762
+ [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
763
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 ome/pj
764
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 ome/pj/tmp
765
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 ` ome/pj/tmp/LUT-play
766
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 ` home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
767
+ ````
768
+
769
+ ## Restoring
770
+
771
+ ### default location for restores
772
+
773
+ dar-backup will use the TEST_RESTORE_DIR location as the Root for restores, if the --restore-dir option has not been supplied.
774
+
775
+ See example below to see where files are restored to.
776
+
777
+ ### --restore-dir option
778
+
779
+ When the --restore-dir option is used for restoring, a directory must be supplied.
780
+
781
+ The directory supplied functions as the Root of the restore operation.
782
+
783
+ **Example**:
784
+
785
+ A backup has been taken using this backup definition:
786
+
787
+ ``` code
788
+ -R /
789
+ -g home/user/Documents
790
+ ```
791
+
792
+ When restoring and using `/tmp` for --restore-dir, the restored files can be found in `/tmp/home/user/Documents`
793
+
794
+ ### a single file
795
+
796
+ ``` code
797
+ . <the virtual env>/bin/activate
798
+ dar-backup --restore <archive_name> --selection "-g path/to/file"
799
+ deactivate
800
+
801
+ ```
802
+
803
+ ### a directory
804
+
805
+ ``` bash
806
+ . <the virtual env>/bin/activate
807
+ dar-backup --restore <archive_name> --selection "-g path/to/directory"
808
+ deactivate
809
+ ```
810
+
811
+ ### .NEF from a specific date
812
+
813
+ ``` bash
814
+ . <the virtual env>/bin/activate
815
+ dar-backup --restore <archive_name> --selection "-X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play"
816
+ deactivate
817
+ ```
818
+
819
+ ### restore test fails with exit code 4
820
+
821
+ "dar" in newer versions emits a question about file ownership, which is "answered" with a "no" via the "-Q" option. That in turn leads to an error code 4.
822
+
823
+ Thus the dar option "--comparison-field=ignore-owner" has been placed in the supplied [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed).
824
+
825
+ This causes dar to restore without an error.
826
+
827
+ It is a good option when using dar as a non-privileged user.
828
+
829
+ ### restore test fails with exit code 5
830
+
831
+ If exit code 5 is emitted on the restore test, FSA (File System specific Attributes) could be the cause.
832
+
833
+ That (might) occur if you backup a file stored on one type of filesystem, and restore it on another type.
834
+ My home directory is on a btrfs filesystem, while /tmp (for the restore test) is on zfs.
835
+
836
+ The restore test can result in an exit code 5, due to the different filesystems used. In order to avoid the errors, the "option "--fsa-scope none" can be used. That will restult in FSA's not being restored.
837
+
838
+ If you need to use this option, un-comment it in the [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed)
839
+
840
+ ## Par2
841
+
842
+ ### Par2 to verify/repair
843
+
844
+ You can run a par2 verification on an archive like this:
845
+
846
+ ```` bash
847
+ for file in <archive>*.dar.par2; do
848
+ par2 verify "$file"
849
+ done
850
+ ````
851
+
852
+ if there are problems with a slice, try to repair it like this:
853
+
854
+ ```` bash
855
+ par2 repair <archive>.<slice number>.dar.par2
856
+ ````
857
+
858
+ ### Par2 create redundancy files
859
+
860
+ If you have merged archives, you will need to create the .par2 redundency files manually.
861
+ Here is an example
862
+
863
+ ```` bash
864
+ for file in <some-archive>_FULL_yyyy-mm-dd.*; do
865
+ par2 c -r5 -n1 "$file"
866
+ done
867
+ ````
868
+
869
+ where "c" is create, -r5 is 5% redundency and -n1 is 1 redundency file
870
+
871
+ ## Points of interest
872
+
873
+ ### Merge FULL with DIFF, creating new FULL
874
+
875
+ Over time, the DIFF archives become larger and larger. At some point one wishes to create a new FULL archive to do DIFF's on.
876
+ One way to do that, is to let dar create a FULL archive from scratch, another is to merge a FULL archive with a DIFF, and from there do DIFF's until they once again gets too large for your taste.
877
+
878
+ I do backups of my homedir. Here it is shown how a FULL archive is merged with a DIFF, creating a new FULL archive.
879
+
880
+ ```` bash
881
+ dar --merge pj-homedir_FULL_2021-09-12 -A pj-homedir_FULL_2021-06-06 -@pj-homedir_DIFF_2021-08-29 -s 12G
882
+
883
+ # test the new FULL archive
884
+ dar -t pj-homedir_FULL_2021-09-12
885
+
886
+ # create Par2 redundancy files
887
+ for file in pj-homedir_FULL_yyyy-mm-dd.*.dar; do
888
+ par2 c -r5 -n1 "$file"
889
+ done
890
+
891
+ ````
892
+
893
+ ### dar manager databases
894
+
895
+ `dar-backup` now saves archive catalogs in dar catalog databases.
896
+
897
+ This makes it easier to restore to a given date when having many FULL, DIFF and INCR archives.
898
+
899
+ If the manager does not add an archive to it's catalog database, `dar-backup` will log an error and continue. The important part is verify the archive is usable and continue to other backup definitions.
900
+
901
+ ### Performance tip due to par2
902
+
903
+ This [dar benchmark page](https://dar.sourceforge.io/doc/benchmark.html) has an interesting note on the slice size.
904
+
905
+ Slice size should be smaller than available RAM, apparently a large performance hit can be avoided keeping the par2 data in memory.
906
+
907
+ ### .darrc sets -vd -vf (since v0.6.4)
908
+
909
+ These [.darrc](#darrc) settings make `dar` print the current directory being processed (-vd) and some stats after (-vf)
910
+
911
+ This is very useful in very long running jobs to get an indication that the backup is proceeding normally.
912
+
913
+ ### Separate log file for command output
914
+
915
+ Dar-backup's log file is called `dar-backup.log`.
916
+
917
+ In order to not clutter that log file with the output of commands being run, a new secondary log file has been introduced `dar-backup-commands.log`.
918
+
919
+ The secondary log file can get quite cluttered, if you want to remove the clutter, run the `clean-log`script with the `--file` option, or simply delete it.
920
+
921
+ ### Skipping cache directories
922
+
923
+ The author uses the `--cache-directory-tagging` option in his [backup definitions](#backup-definition-example).
924
+
925
+ The effect is that directories with the [CACHEDIR.TAG](https://bford.info/cachedir/) file are not backed up. Those directories contain content fetched from the net, which is of an ephemeral nature and probably not what you want to back up.
926
+
927
+ If the option is not in the backup definition, the cache directories are backed up as any other.
928
+
929
+ ### Progress bar and current directory
930
+
931
+ If you run dar-backup interactively in a "normal" console on your computer,
932
+ dar-backup displays 2 visual artifacts to show progress.
933
+
934
+ 1. a progress bar that fills up and starts over
935
+ 2. a status line showing the directory being backed up. If the directory is big and takes time to backup, the line is not changing, but you will probably know there is a lot to backup.
936
+
937
+ The indicators are not shown if dar-backup is run from systemd or if it is used in terminal multiplexers like `tmux` or `screen`. So no polluting of journald logs.
938
+
939
+ ## Todo
940
+
941
+ - Look into a way to move the .par2 files away from the `dar` slices, to maximize chance of good redundancy.
942
+ - Add option to dar-backup to use the `dar` option `--fsa-scope none`
943
+
944
+ ## Reference
945
+
946
+ ### test coverage
947
+
948
+ Running
949
+
950
+ ```` bash
951
+ pytest --cov=dar_backup tests/
952
+ ````
953
+
954
+ results for version 0.6.17 in this report:
955
+
956
+ ```` code
957
+ ---------- coverage: platform linux, python 3.12.3-final-0 -----------
958
+ Name Stmts Miss Cover
959
+ -------------------------------------------------------------------------------------
960
+ venv/lib/python3.12/site-packages/dar_backup/__about__.py 1 0 100%
961
+ venv/lib/python3.12/site-packages/dar_backup/__init__.py 0 0 100%
962
+ venv/lib/python3.12/site-packages/dar_backup/clean_log.py 68 14 79%
963
+ venv/lib/python3.12/site-packages/dar_backup/cleanup.py 196 53 73%
964
+ venv/lib/python3.12/site-packages/dar_backup/config_settings.py 66 8 88%
965
+ venv/lib/python3.12/site-packages/dar_backup/dar_backup.py 464 99 79%
966
+ venv/lib/python3.12/site-packages/dar_backup/installer.py 46 46 0%
967
+ venv/lib/python3.12/site-packages/dar_backup/manager.py 316 72 77%
968
+ venv/lib/python3.12/site-packages/dar_backup/util.py 162 34 79%
969
+ -------------------------------------------------------------------------------------
970
+ TOTAL 1319 326 75%
971
+ ````
972
+
973
+ ### dar-backup options
974
+
975
+ This script does backups, validation and restoring. It has the following options:
976
+
977
+ ``` code
978
+ -F, --full-backup Perform a full backup.
979
+ -D, --differential-backup Perform a differential backup.
980
+ -I, --incremental-backup Perform an incremental backup.
981
+ -d, --backup-definition <name> Specify the backup definition file.
982
+ --alternate-reference-archive <file> Use a different archive for DIFF/INCR backups.
983
+ -c, --config-file <path> Specify the path to the configuration file.
984
+ --darrc <path> Specify an optional path to .darrc.
985
+ --examples Show examples of using dar-backup.py.
986
+ -l, --list List available backups.
987
+ --list-contents <archive> List the contents of a specified archive.
988
+ --selection <params> Define file selection for listing/restoring.
989
+ --restore <archive> Restore a specified archive.
990
+ -r, --restore-dir <path> Directory to restore files to.
991
+ --verbose Enable verbose output.
992
+ --suppress-dar-msg Filter out this from the darrc: "-vt", "-vs", "-vd", "-vf", "-va"
993
+ --log-level <level> `debug` or `trace`, default is `info`.
994
+ --log-stdout Also print log messages to stdout.
995
+ --do-not-compare Do not compare restores to file system.
996
+ -v --version Show version and license information.
997
+ ```
998
+
999
+ ### manager options
1000
+
1001
+ This script manages `dar` databases and catalogs. Available options:
1002
+
1003
+ ``` code
1004
+ -c, --config-file Path to dar-backup.conf
1005
+ --create-db Create missing databases for all backup definitions.
1006
+ --alternate-archive-dir <path> Use this directory instead of BACKUP_DIR in the config file.
1007
+ --add-dir <path> Add all archive catalogs in this directory to databases.
1008
+ -d, --backup-def <name> Restrict to work only on this backup definition.
1009
+ --add-specific-archive <archive> Add this archive to the catalog database.
1010
+ --remove-specific-archive <archive> Remove this archive from the catalog database.
1011
+ -l, --list-catalogs List catalogs in databases for all backup definitions.
1012
+ --list-catalog-contents <num> List contents of a catalog by catalog number.
1013
+ --list-archive-contents <archive> List contents of an archive’s catalog, given the archive name.
1014
+ --find-file <file> Search catalogs for a specific file.
1015
+ --verbose Enable verbose output.
1016
+ --log-level <level> `debug` or `trace`, default is `info`", default="info".
1017
+ ```
1018
+
1019
+ ### cleanup options
1020
+
1021
+ This script cleans up old backups and par2 files. Supported options:
1022
+
1023
+ ``` code
1024
+ -d, --backup-definition Backup definition to cleanup.
1025
+ -c, --config-file Path to 'dar-backup.conf'
1026
+ -v, --version Show version & license information.
1027
+ --alternate-archive-dir Clean up in this directory instead of the default one.
1028
+ --cleanup-specific-archives "<archive>, <>, ..." Comma separated list of archives to cleanup.
1029
+ -l, --list List available archives (filter using the -d option).
1030
+ --verbose Print various status messages to screen.
1031
+ --log-level <level> `debug` or `trace`, default is `info`", default="info".
1032
+ --log-stdout Print log messages to stdout.
1033
+ --test-mode This is used when running pytest test cases
1034
+ ```
1035
+
1036
+ ### clean-log options
1037
+
1038
+ This script removes excessive logging output from `dar` logs, improving readability and efficiency. Available options:
1039
+
1040
+ ``` code
1041
+ -f, --file <path> Specify the log file(s) to be cleaned.
1042
+ -c, --config-file <path> Path to dar-backup.conf.
1043
+ --dry-run Show which lines would be removed without modifying the file.
1044
+ -v, --version Display version and licensing information.
1045
+ -h, --help Displays usage info
1046
+ ```
1047
+
1048
+ ### installer options
1049
+
1050
+ Sets up `dar-backup`for a user.
1051
+
1052
+ It is non-destructive and stops if directories are already in place.
1053
+
1054
+ Create directories:
1055
+
1056
+ - ~/.config/dar-backup/
1057
+ - ~/.config/dar-backup/backup.d/
1058
+ - ~/dar-backup/
1059
+ - ~/dar-backup/backups
1060
+ - ~/dar-backup/restore
1061
+
1062
+ Sets up demo config files:
1063
+
1064
+ - ~/.config/dar-backup/dar-backup.conf
1065
+ - ~/.config/dar-backup/backup.d/default
1066
+
1067
+ ``` code
1068
+ -i, --install Sets up `dar-backup`.
1069
+ -v, --version Display version and licensing information.
1070
+ -h, --help Displays usage info
1071
+ ```
1072
+
1073
+ ### dar-backup-systemd
1074
+
1075
+ Generates and optionally install systemd user service units and timers
1076
+
1077
+ ``` code
1078
+ -h, --help Show this help message and exit
1079
+ --venv VENV Path to the Python venv with dar-backup
1080
+ --dar-path DAR_PATH Optional path to dar binary's directory
1081
+ --install Install the units to ~/.config/systemd/user
1082
+ ```