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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dar-backup
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: A script to do full, differential and incremental backups using dar. Some files are restored from the backups during verification, after which par2 redundancy files are created. The script also has a cleanup feature to remove old backups and par2 files.
|
|
5
5
|
Project-URL: GPG Public Key, https://keys.openpgp.org/search?q=dar-backup@pm.me
|
|
6
6
|
Project-URL: Homepage, https://github.com/per2jensen/dar-backup/tree/main/v2
|
|
@@ -691,7 +691,27 @@ Classifier: Topic :: System :: Archiving :: Backup
|
|
|
691
691
|
Requires-Python: >=3.9
|
|
692
692
|
Requires-Dist: argcomplete>=3.6.2
|
|
693
693
|
Requires-Dist: inputimeout>=1.0.4
|
|
694
|
+
Requires-Dist: jinja2>=3.1.6
|
|
694
695
|
Requires-Dist: rich>=13.0.0
|
|
696
|
+
Provides-Extra: dev
|
|
697
|
+
Requires-Dist: anyio>=4.4.0; extra == 'dev'
|
|
698
|
+
Requires-Dist: black>=25.1.0; extra == 'dev'
|
|
699
|
+
Requires-Dist: coverage>=7.8.2; extra == 'dev'
|
|
700
|
+
Requires-Dist: h11>=0.16.0; extra == 'dev'
|
|
701
|
+
Requires-Dist: httpcore>=0.17.3; extra == 'dev'
|
|
702
|
+
Requires-Dist: psutil>=7.0.0; extra == 'dev'
|
|
703
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
704
|
+
Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
|
|
705
|
+
Requires-Dist: pytest-timeout>=2.4.0; extra == 'dev'
|
|
706
|
+
Requires-Dist: pytest>=8.4.0; extra == 'dev'
|
|
707
|
+
Requires-Dist: requests>=2.32.2; extra == 'dev'
|
|
708
|
+
Requires-Dist: wheel>=0.45.1; extra == 'dev'
|
|
709
|
+
Requires-Dist: zipp>=3.19.1; extra == 'dev'
|
|
710
|
+
Provides-Extra: packaging
|
|
711
|
+
Requires-Dist: build>=1.2.2; extra == 'packaging'
|
|
712
|
+
Requires-Dist: hatch>=1.14.1; extra == 'packaging'
|
|
713
|
+
Requires-Dist: hatchling>=1.27.0; extra == 'packaging'
|
|
714
|
+
Requires-Dist: twine>=6.1.0; extra == 'packaging'
|
|
695
715
|
Description-Content-Type: text/markdown
|
|
696
716
|
|
|
697
717
|
<!-- markdownlint-disable MD024 -->
|
|
@@ -699,11 +719,13 @@ Description-Content-Type: text/markdown
|
|
|
699
719
|
|
|
700
720
|
**Reliable DAR backups, automated in clean Python**
|
|
701
721
|
|
|
702
|
-
[](https://codecov.io/gh/per2jensen/dar-backup)
|
|
723
|
+
[](https://snyk.io/test/github/per2jensen/dar-backup)
|
|
703
724
|

|
|
704
725
|
[](https://pypi.org/project/dar-backup/)
|
|
705
|
-
[](https://pypi.org/project/dar-backup/)
|
|
727
|
+
[](https://github.com/per2jensen/dar-backup/blob/main/v2/doc/weekly_clones.png)
|
|
728
|
+
[](https://github.com/per2jensen/dar-backup/blob/main/v2/doc/weekly_clones.png)
|
|
707
729
|
|
|
708
730
|
The wonderful 'dar' [Disk Archiver](https://github.com/Edrusb/DAR) is used for
|
|
709
731
|
the heavy lifting, together with the [parchive](https://github.com/Parchive/par2cmdline) suite in these scripts.
|
|
@@ -712,14 +734,16 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
712
734
|
|
|
713
735
|
## TL;DR
|
|
714
736
|
|
|
715
|
-
`dar-backup` is a Python-powered CLI for creating and validating full, differential, and incremental backups using dar and par2
|
|
737
|
+
`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.
|
|
716
738
|
|
|
717
739
|
## Table of Contents
|
|
718
740
|
|
|
719
741
|
- [Reliable `dar` backups wrapped in Python](#dar-backup)
|
|
720
742
|
- [My use case](#my-use-case)
|
|
743
|
+
- [Features](#features)
|
|
721
744
|
- [License](#license)
|
|
722
745
|
- [Changelog version 2](https://github.com/per2jensen/dar-backup/blob/main/v2/Changelog.md)
|
|
746
|
+
- [Quick Guide](#quick-guide)
|
|
723
747
|
- [Status](#status)
|
|
724
748
|
- [GPG Signing key](#gpg-signing-key)
|
|
725
749
|
- [Breaking change in version 0.6.0](#breaking-change-in-version-060)
|
|
@@ -731,7 +755,7 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
731
755
|
- [1 - installation](#1---installation)
|
|
732
756
|
- [2 - configuration](#2---configuration)
|
|
733
757
|
- [3 - generate catalog databases](#3---generate-catalog-databases)
|
|
734
|
-
- [4 -
|
|
758
|
+
- [4 - give `dar-backup` a spin](#4---give-dar-backup-a-spin)
|
|
735
759
|
- [5 - deactivate venv](#5---deactivate-venv)
|
|
736
760
|
- [Config](#config)
|
|
737
761
|
- [Config file](#config-file)
|
|
@@ -766,6 +790,7 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
766
790
|
- [Skipping cache directories](#skipping-cache-directories)
|
|
767
791
|
- [Progress bar + current directory](#progress-bar-and-current-directory)
|
|
768
792
|
- [Shell Autocompletion](#shell-autocompletion)
|
|
793
|
+
- [Easy development setup](#easy-development-setup)
|
|
769
794
|
- [Todo](#todo)
|
|
770
795
|
- [Known Limitations / Edge Cases](#known-limitations--edge-cases)
|
|
771
796
|
- [Reference](#reference)
|
|
@@ -775,21 +800,22 @@ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-bac
|
|
|
775
800
|
- [manager](#manager-options)
|
|
776
801
|
- [cleanup](#cleanup-options)
|
|
777
802
|
- [clean-log](#clean-log-options)
|
|
778
|
-
- [dar-backup-systemd](#dar-backup-systemd)
|
|
779
|
-
- [Installer](#installer)
|
|
780
|
-
- [demo](#demo)
|
|
803
|
+
- [dar-backup-systemd](#dar-backup-systemd-options)
|
|
804
|
+
- [Installer](#installer-options)
|
|
805
|
+
- [demo](#demo-options)
|
|
781
806
|
|
|
782
807
|
## My use case
|
|
783
808
|
|
|
784
|
-
I
|
|
809
|
+
I needed the following:
|
|
785
810
|
|
|
786
|
-
-
|
|
787
|
-
-
|
|
811
|
+
- Backup my workstation to a remote server
|
|
812
|
+
- Backup primarily photos, home made video and different types of documents
|
|
813
|
+
- 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
|
|
788
814
|
|
|
789
|
-
I
|
|
815
|
+
- Backup cloud storage (cloud is convenient, but I want control over my backups)
|
|
816
|
+
- A non-privileged user can perform a mount
|
|
817
|
+
- A privileged user cannot look into the filesystem --> a backup script running as root is not suitable
|
|
790
818
|
|
|
791
|
-
- Backup my cloud storage to something local (cloud is convenient, but I want control over my backups)
|
|
792
|
-
- Backup primarily photos, video and different types of documents
|
|
793
819
|
- 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.
|
|
794
820
|
- During backup archives must be tested and a restore test (however small) performed
|
|
795
821
|
- Archives stored on a server with a reliable file system (easy to mount a directory over sshfs)
|
|
@@ -797,11 +823,252 @@ I have cloud storage mounted on a directory within my home dir. The filesystem i
|
|
|
797
823
|
|
|
798
824
|
I do not need the encryption features of dar, as all storage is already encrypted.
|
|
799
825
|
|
|
826
|
+
## Features
|
|
827
|
+
|
|
828
|
+
- The battle tested [dar](https://github.com/Edrusb/DAR) Disk Archiver is used for the actual backups - it comes highly recommended.
|
|
829
|
+
- Backup with test of backup and (configurable) restore tests of files with comparison to source
|
|
830
|
+
- [Redundancy files](#par2) created for patching bitrot of the archives (size configurable)
|
|
831
|
+
- Simple [backup definitions](#backup-definition-example) defining what to backup (as many as you need)
|
|
832
|
+
- [Backup catalogs](#dar-manager-databases) in databases, optionally on a disk different from the backups
|
|
833
|
+
- Flexible and precise logging
|
|
834
|
+
- Bash and zsh shell autocompletion for a nice CLI experience, [available completions](#shell-autocompletion):
|
|
835
|
+
|
|
836
|
+
- Options for `dar-backup`, `cleanup`, `manager`
|
|
837
|
+
- Backup definitions
|
|
838
|
+
- Archives - filtered to backup definition if given
|
|
839
|
+
- Catalogs - filtered to backup definition if given
|
|
840
|
+
|
|
841
|
+
- `dar-backup` is easy to install and configure.
|
|
842
|
+
|
|
843
|
+
- ✅ The author has used dar-backup since > 4 years, and has been saved multiple times.
|
|
844
|
+
|
|
800
845
|
## License
|
|
801
846
|
|
|
802
847
|
These scripts are licensed under the GPLv3 license.
|
|
803
848
|
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.
|
|
804
849
|
|
|
850
|
+
## Quick Guide
|
|
851
|
+
|
|
852
|
+
This purpose of this quick guide is to show how `dar-backup` works in a few simple steps.
|
|
853
|
+
|
|
854
|
+
The package include a `demo`application, that can help you set up `dar-backup` quickly.
|
|
855
|
+
|
|
856
|
+
> ⚠️ **Assumption**
|
|
857
|
+
>
|
|
858
|
+
> The demo program uses these directories in your home directory:
|
|
859
|
+
>
|
|
860
|
+
> - $HOME/dar-backup
|
|
861
|
+
> - $HOME/.config/dar-backup
|
|
862
|
+
>
|
|
863
|
+
> It is assumed they **do not exist** before running the demo.
|
|
864
|
+
>
|
|
865
|
+
> Python **>= 3.9** is required
|
|
866
|
+
|
|
867
|
+
<br>
|
|
868
|
+
|
|
869
|
+
**Let's roll** with installation, backup, list backup content, restore & restore check
|
|
870
|
+
|
|
871
|
+
The demo is known to work on an Ubuntu 24.04 clean VM as delivered from `Multipass`
|
|
872
|
+
|
|
873
|
+
```bash
|
|
874
|
+
sudo apt -y install dar par2 python3 python3-venv
|
|
875
|
+
INSTALL_DIR=/tmp/dar-backup
|
|
876
|
+
mkdir "$INSTALL_DIR"
|
|
877
|
+
cd "$INSTALL_DIR"
|
|
878
|
+
python3 -m venv venv # create the virtual environment
|
|
879
|
+
. venv/bin/activate # activate the virtual environment
|
|
880
|
+
pip install dar-backup # run pip to install `dar-backup` into the virtual environment
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
<details>
|
|
884
|
+
|
|
885
|
+
<summary>🎯 Install details</summary>
|
|
886
|
+
|
|
887
|
+
```bash
|
|
888
|
+
(venv) $ INSTALL_DIR=/tmp/dar-backup
|
|
889
|
+
mkdir "$INSTALL_DIR"
|
|
890
|
+
cd "$INSTALL_DIR"
|
|
891
|
+
python3 -m venv venv # create the virtual environment
|
|
892
|
+
. venv/bin/activate # activate the virtual environment
|
|
893
|
+
pip install dar-backup # run pip to install `dar-backup`
|
|
894
|
+
Collecting dar-backup
|
|
895
|
+
Downloading dar_backup-0.6.21-py3-none-any.whl.metadata (88 kB)
|
|
896
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.5/88.5 kB 3.7 MB/s eta 0:00:00
|
|
897
|
+
Collecting argcomplete>=3.6.2 (from dar-backup)
|
|
898
|
+
Using cached argcomplete-3.6.2-py3-none-any.whl.metadata (16 kB)
|
|
899
|
+
Collecting inputimeout>=1.0.4 (from dar-backup)
|
|
900
|
+
Using cached inputimeout-1.0.4-py3-none-any.whl.metadata (2.2 kB)
|
|
901
|
+
Collecting rich>=13.0.0 (from dar-backup)
|
|
902
|
+
Using cached rich-14.0.0-py3-none-any.whl.metadata (18 kB)
|
|
903
|
+
Collecting markdown-it-py>=2.2.0 (from rich>=13.0.0->dar-backup)
|
|
904
|
+
Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
|
|
905
|
+
Collecting pygments<3.0.0,>=2.13.0 (from rich>=13.0.0->dar-backup)
|
|
906
|
+
Using cached pygments-2.19.1-py3-none-any.whl.metadata (2.5 kB)
|
|
907
|
+
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=13.0.0->dar-backup)
|
|
908
|
+
Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
|
|
909
|
+
Downloading dar_backup-0.6.21-py3-none-any.whl (101 kB)
|
|
910
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.9/101.9 kB 16.2 MB/s eta 0:00:00
|
|
911
|
+
Using cached argcomplete-3.6.2-py3-none-any.whl (43 kB)
|
|
912
|
+
Using cached inputimeout-1.0.4-py3-none-any.whl (4.6 kB)
|
|
913
|
+
Using cached rich-14.0.0-py3-none-any.whl (243 kB)
|
|
914
|
+
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
|
|
915
|
+
Using cached pygments-2.19.1-py3-none-any.whl (1.2 MB)
|
|
916
|
+
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
|
|
917
|
+
Installing collected packages: pygments, mdurl, inputimeout, argcomplete, markdown-it-py, rich, dar-backup
|
|
918
|
+
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
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
</details>
|
|
922
|
+
|
|
923
|
+
Setup the demo configurations and show a few operations
|
|
924
|
+
|
|
925
|
+
<br>
|
|
926
|
+
|
|
927
|
+
```bash
|
|
928
|
+
# See reference section for options tweaking the install
|
|
929
|
+
demo --install
|
|
930
|
+
|
|
931
|
+
# create catalog database
|
|
932
|
+
manager --create-db
|
|
933
|
+
|
|
934
|
+
# FULL backup as defined in backup definition `demo`
|
|
935
|
+
dar-backup --full-backup
|
|
936
|
+
|
|
937
|
+
# List the contents of the backup
|
|
938
|
+
dar-backup --list-contents demo_FULL_$(date '+%F')
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
<details>
|
|
942
|
+
|
|
943
|
+
<summary>🎯 --list details</summary>
|
|
944
|
+
|
|
945
|
+
```bash
|
|
946
|
+
(venv) $ demo --install
|
|
947
|
+
Directories created.
|
|
948
|
+
File generated at '/home/user/.config/dar-backup/backup.d/demo'
|
|
949
|
+
File generated at '/home/user/.config/dar-backup/dar-backup.conf'
|
|
950
|
+
1. Now run `manager --create-db` to create the catalog database.
|
|
951
|
+
2. Then you can run `dar-backup --full-backup` to create a backup.
|
|
952
|
+
3. List backups with `dar-backup --list`
|
|
953
|
+
4. List contents of a backup with `dar-backup --list-contents <backup-name>`
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
(venv) $ manager --create-db
|
|
958
|
+
========== Startup Settings ==========
|
|
959
|
+
manager.py: 0.7.1
|
|
960
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
961
|
+
Logfile: /home/user/dar-backup/dar-backup.log
|
|
962
|
+
dar_manager: /home/user/.local/dar/bin/dar_manager
|
|
963
|
+
dar_manager v.: 1.9.0
|
|
964
|
+
======================================
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
(venv) $ dar-backup --full-backup
|
|
969
|
+
========== Startup Settings ==========
|
|
970
|
+
dar-backup.py: 0.7.1
|
|
971
|
+
dar path: /home/user/.local/dar/bin/dar
|
|
972
|
+
dar version: 2.7.17
|
|
973
|
+
Script directory: /home/user/git/dar-backup/v2/src/dar_backup
|
|
974
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
975
|
+
.darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
|
|
976
|
+
======================================
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
(venv) $ dar-backup --list-contents demo_FULL_$(date '+%F')
|
|
981
|
+
========== Startup Settings ==========
|
|
982
|
+
dar-backup.py: 0.7.1
|
|
983
|
+
dar path: /home/user/.local/dar/bin/dar
|
|
984
|
+
dar version: 2.7.17
|
|
985
|
+
Script directory: /home/user/git/dar-backup/v2/src/dar_backup
|
|
986
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
987
|
+
.darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
|
|
988
|
+
======================================
|
|
989
|
+
[Saved][-] [-L-][ 49%][ ] drwx------ user user 8 kio Sat May 17 13:13:59 2025 .config
|
|
990
|
+
[Saved][-] [-L-][ 49%][ ] drwxrwxr-x user user 8 kio Tue May 6 20:55:40 2025 .config/dar-backup
|
|
991
|
+
[Saved][-] [-L-][ 48%][ ] drwxrwxr-x user user 6 kio Sat May 17 13:26:21 2025 .config/dar-backup/backup.d
|
|
992
|
+
[Saved][ ] [-L-][ 40%][ ] -rw-rw-r-- user user 764 o Sun Feb 23 21:23:01 2025 .config/dar-backup/backup.d/media-files
|
|
993
|
+
[Saved][ ] [-L-][ 41%][ ] -rw-rw-r-- user user 933 o Sun Feb 23 21:23:15 2025 .config/dar-backup/backup.d/pCloudDrive
|
|
994
|
+
[Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 1 kio Sun Mar 16 10:40:29 2025 .config/dar-backup/backup.d/test
|
|
995
|
+
[Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 824 o Tue May 13 17:00:52 2025 .config/dar-backup/backup.d/default
|
|
996
|
+
[Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 1 kio Sat May 3 10:40:33 2025 .config/dar-backup/backup.d/user-homedir
|
|
997
|
+
[Saved][ ] [-L-][ 54%][ ] -rw-rw-r-- user user 1 kio Sat May 17 18:17:40 2025 .config/dar-backup/backup.d/demo
|
|
998
|
+
[Saved][ ] [-L-][ 55%][ ] -rw-rw-r-- user user 1 kio Sat May 17 18:17:40 2025 .config/dar-backup/dar-backup.conf
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
</details>
|
|
1002
|
+
|
|
1003
|
+
<br>
|
|
1004
|
+
|
|
1005
|
+
Perform a restore and show the restored files
|
|
1006
|
+
|
|
1007
|
+
```bash
|
|
1008
|
+
# Restore all files in the backup
|
|
1009
|
+
dar-backup --restore demo_FULL_$(date '+%F') --verbose
|
|
1010
|
+
|
|
1011
|
+
# Prove the files have been restored to directory as configured
|
|
1012
|
+
find $HOME/dar-backup/restore
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
<details>
|
|
1016
|
+
|
|
1017
|
+
<summary>🎯 --restore details</summary>
|
|
1018
|
+
|
|
1019
|
+
```bash
|
|
1020
|
+
(venv) $ dar-backup --restore demo_FULL_$(date '+%F') --verbose
|
|
1021
|
+
========== Startup Settings ==========
|
|
1022
|
+
dar-backup.py: 0.7.1
|
|
1023
|
+
dar path: /home/user/.local/dar/bin/dar
|
|
1024
|
+
dar version: 2.7.17
|
|
1025
|
+
Script directory: /home/user/git/dar-backup/v2/src/dar_backup
|
|
1026
|
+
Config file: /home/user/.config/dar-backup/dar-backup.conf
|
|
1027
|
+
.darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
|
|
1028
|
+
Backup.d dir: /home/user/.config/dar-backup/backup.d
|
|
1029
|
+
Backup dir: /home/user/dar-backup/backups
|
|
1030
|
+
Restore dir: /home/user/dar-backup/restore
|
|
1031
|
+
Logfile location: /home/user/dar-backup/dar-backup.log
|
|
1032
|
+
PAR2 enabled: True
|
|
1033
|
+
--do-not-compare: False
|
|
1034
|
+
======================================
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
(venv) $ find ~/dar-backup/restore/
|
|
1039
|
+
/home/user/dar-backup/restore/
|
|
1040
|
+
/home/user/dar-backup/restore/.config
|
|
1041
|
+
/home/user/dar-backup/restore/.config/dar-backup
|
|
1042
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d
|
|
1043
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/media-files
|
|
1044
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/pCloudDrive
|
|
1045
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/test
|
|
1046
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/default
|
|
1047
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/user-homedir
|
|
1048
|
+
/home/user/dar-backup/restore/.config/dar-backup/backup.d/demo
|
|
1049
|
+
/home/user/dar-backup/restore/.config/dar-backup/dar-backup.conf
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
</details>
|
|
1053
|
+
|
|
1054
|
+
<br>
|
|
1055
|
+
|
|
1056
|
+
> ✅ **Next steps**
|
|
1057
|
+
>
|
|
1058
|
+
> Play with `demo's` options:
|
|
1059
|
+
>
|
|
1060
|
+
> - --root-dir (perhaps $HOME)
|
|
1061
|
+
> - --dir-to-backup (perhaps Pictures)
|
|
1062
|
+
> - --backup-dir (perhaps /media/user/big-disk)
|
|
1063
|
+
>
|
|
1064
|
+
> See log file: `cat "$HOME/dar-backup/dar-backup.log"`
|
|
1065
|
+
>
|
|
1066
|
+
> Checkout [systemd timers and services](#generate-systemd-files)
|
|
1067
|
+
>
|
|
1068
|
+
> Checkout [shell autocompletion (very nice !)](#shell-autocompletion)
|
|
1069
|
+
>
|
|
1070
|
+
> Checkout the [reference section](#reference)
|
|
1071
|
+
|
|
805
1072
|
## Status
|
|
806
1073
|
|
|
807
1074
|
As of August 8, 2024 I am using the alpha versions of `dar-backup` (alpha-0.5.9 onwards) in my automated backup routine.
|
|
@@ -923,8 +1190,9 @@ Please review the [Code of Conduct](https://github.com/per2jensen/dar-backup/blo
|
|
|
923
1190
|
|
|
924
1191
|
## Requirements
|
|
925
1192
|
|
|
1193
|
+
- A linux system
|
|
926
1194
|
- dar
|
|
927
|
-
- par2
|
|
1195
|
+
- parchive (par2)
|
|
928
1196
|
- python3
|
|
929
1197
|
- python3-venv
|
|
930
1198
|
|
|
@@ -977,7 +1245,7 @@ See more [here](#gpg-signing-key).
|
|
|
977
1245
|
|
|
978
1246
|
### 1 - installation
|
|
979
1247
|
|
|
980
|
-
Installation is currently in a venv. These commands are installed in the venv:
|
|
1248
|
+
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:
|
|
981
1249
|
|
|
982
1250
|
- dar-back
|
|
983
1251
|
- cleanup
|
|
@@ -989,15 +1257,15 @@ Installation is currently in a venv. These commands are installed in the venv:
|
|
|
989
1257
|
|
|
990
1258
|
Note:
|
|
991
1259
|
|
|
992
|
-
The
|
|
1260
|
+
The modules `inputimeout`, `rich`and `argcomplete` are installed into the venv and used by `dar-backup`
|
|
993
1261
|
|
|
994
|
-
To install
|
|
1262
|
+
To install `dar-backup`, create a venv and run pip:
|
|
995
1263
|
|
|
996
1264
|
```bash
|
|
997
1265
|
mkdir $HOME/tmp
|
|
998
1266
|
cd $HOME/tmp
|
|
999
1267
|
python3 -m venv venv # create the virtual environment
|
|
1000
|
-
. venv/bin/activate # activate the virtual
|
|
1268
|
+
. venv/bin/activate # activate the virtual environment
|
|
1001
1269
|
pip install dar-backup # run pip to install `dar-backup`
|
|
1002
1270
|
```
|
|
1003
1271
|
|
|
@@ -1010,7 +1278,7 @@ alias db=". ~/tmp/venv/bin/activate; dar-backup -v"
|
|
|
1010
1278
|
drop the alias into ~/.bashrc like this:
|
|
1011
1279
|
|
|
1012
1280
|
```bash
|
|
1013
|
-
grep -qxF 'alias db="
|
|
1281
|
+
grep -qxF 'alias db="' ~/.bashrc \
|
|
1014
1282
|
|| echo 'alias db=". ~/tmp/venv/bin/activate; dar-backup -v"' >> ~/.bashrc
|
|
1015
1283
|
|
|
1016
1284
|
source ~/.bashrc
|
|
@@ -1029,24 +1297,25 @@ See section 15 and section 16 in the supplied "LICENSE" file.
|
|
|
1029
1297
|
|
|
1030
1298
|
### 2 - configuration
|
|
1031
1299
|
|
|
1032
|
-
The dar-backup
|
|
1300
|
+
The dar-backup [installer](#installer-options) application can be used to setup the needed directories for `dar-backup` to work.
|
|
1301
|
+
It creates necessary directories as prescribed in the config file and optionally creates manager databases.
|
|
1033
1302
|
|
|
1034
|
-
|
|
1303
|
+
`installer` can also add configuration of shell auto completion.
|
|
1035
1304
|
|
|
1036
|
-
|
|
1037
|
-
demo --install
|
|
1038
|
-
```
|
|
1305
|
+
Step 1:
|
|
1039
1306
|
|
|
1040
|
-
|
|
1307
|
+
Create a config file - [see details on config file](#config-file))
|
|
1041
1308
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1309
|
+
Step 2:
|
|
1310
|
+
|
|
1311
|
+
Create one or more backup definitions - [see details on backup definitions](#backup-definition-example)
|
|
1312
|
+
|
|
1313
|
+
Step 3:
|
|
1314
|
+
|
|
1315
|
+
Run the installer:
|
|
1316
|
+
|
|
1317
|
+
```bash
|
|
1318
|
+
installer --config <path to dar-backup.conf> --install-autocompletion
|
|
1050
1319
|
```
|
|
1051
1320
|
|
|
1052
1321
|
### 3 - generate catalog databases
|
|
@@ -1059,22 +1328,33 @@ Generate the archive catalog database(s).
|
|
|
1059
1328
|
manager --create-db
|
|
1060
1329
|
```
|
|
1061
1330
|
|
|
1062
|
-
### 4 -
|
|
1331
|
+
### 4 - give dar-backup a spin
|
|
1063
1332
|
|
|
1064
|
-
|
|
1065
|
-
[Backup definitions](#backup-definition-example) are in place in BACKUP.D_DIR (see [config file](#config-file)).
|
|
1333
|
+
You are now ready to do backups as configured in your backup definition(s).
|
|
1066
1334
|
|
|
1067
|
-
|
|
1335
|
+
Give `dar-backup`a spin:
|
|
1068
1336
|
|
|
1069
1337
|
```bash
|
|
1070
|
-
dar-backup --full-backup
|
|
1338
|
+
dar-backup --full-backup --verbose
|
|
1339
|
+
|
|
1340
|
+
# list backups
|
|
1341
|
+
dar-backup --list
|
|
1342
|
+
|
|
1343
|
+
# list contents of a dar backup
|
|
1344
|
+
dar-backup --list-contents <TAB>... <choose a backup>
|
|
1345
|
+
|
|
1346
|
+
# see some examples on usage
|
|
1347
|
+
dar-backup --examples
|
|
1348
|
+
|
|
1349
|
+
# see the log file
|
|
1350
|
+
cat "$HOME/dar-backup/dar-backup.log"
|
|
1071
1351
|
```
|
|
1072
1352
|
|
|
1073
|
-
If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option.
|
|
1353
|
+
If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option.
|
|
1074
1354
|
|
|
1075
1355
|
If you want more log messages, use the `--verbose` or `--log-level debug` for even more.
|
|
1076
1356
|
|
|
1077
|
-
If you want a backup
|
|
1357
|
+
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)).
|
|
1078
1358
|
|
|
1079
1359
|
```bash
|
|
1080
1360
|
dar-backup --full-backup -d <your backup definition>
|
|
@@ -1082,7 +1362,7 @@ dar-backup --full-backup -d <your backup definition>
|
|
|
1082
1362
|
|
|
1083
1363
|
### 5 - deactivate venv
|
|
1084
1364
|
|
|
1085
|
-
Deactivate the virtual environment (venv)
|
|
1365
|
+
Deactivate the virtual environment (venv).
|
|
1086
1366
|
|
|
1087
1367
|
```bash
|
|
1088
1368
|
deactivate
|
|
@@ -1101,6 +1381,9 @@ Tilde `~` and environment variables can be used in the paths for various file lo
|
|
|
1101
1381
|
```text
|
|
1102
1382
|
[MISC]
|
|
1103
1383
|
LOGFILE_LOCATION=~/.dar-backup.log
|
|
1384
|
+
# optional parameters
|
|
1385
|
+
# LOGFILE_MAX_BYTES = 26214400 # 25 MB max file size is default, change as neeeded
|
|
1386
|
+
# LOGFILE_BACKUP_COUNT = 5 # 5 backup log files is default, change as needed
|
|
1104
1387
|
MAX_SIZE_VERIFICATION_MB = 20
|
|
1105
1388
|
MIN_SIZE_VERIFICATION_MB = 1
|
|
1106
1389
|
NO_FILES_VERIFICATION = 5
|
|
@@ -1119,6 +1402,8 @@ TEST_RESTORE_DIR = /tmp/dar-backup/restore/
|
|
|
1119
1402
|
|
|
1120
1403
|
[AGE]
|
|
1121
1404
|
# age settings are in days
|
|
1405
|
+
# `cleanup` script removes archives and their .par redundancy files if older than configured.
|
|
1406
|
+
# `cleanup` does not remove FULL archives, unless specifically told to and a "y" is answered to "are you sure?".
|
|
1122
1407
|
DIFF_AGE = 100
|
|
1123
1408
|
INCR_AGE = 40
|
|
1124
1409
|
|
|
@@ -1274,6 +1559,12 @@ The name of the file is the name of the backup definition.
|
|
|
1274
1559
|
|
|
1275
1560
|
You can use as many backup definitions as you need.
|
|
1276
1561
|
|
|
1562
|
+
> Note 👉
|
|
1563
|
+
>
|
|
1564
|
+
> Environment variables and tilde (~) not allowed here. `dar` does not expand them.
|
|
1565
|
+
>
|
|
1566
|
+
> See [TODO](#todo)
|
|
1567
|
+
|
|
1277
1568
|
```text
|
|
1278
1569
|
# Switch to ordered selection mode, which means that the following
|
|
1279
1570
|
# options will be considered top to bottom
|
|
@@ -1419,20 +1710,20 @@ deactivate
|
|
|
1419
1710
|
gives something like
|
|
1420
1711
|
|
|
1421
1712
|
```text
|
|
1422
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
1423
|
-
[Saved][ ] [-L-][ 93%][ ] -rw-rw-r--
|
|
1424
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
1425
|
-
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x
|
|
1426
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1427
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1428
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1429
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1430
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1431
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1432
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1433
|
-
[Saved][ ] [-L-][ 91%][ ] -rw-rw-r--
|
|
1434
|
-
[Saved][ ] [-L-][ 92%][ ] -rw-rw-r--
|
|
1435
|
-
[Saved][ ] [-L-][ 91%][ ] -rw-rw-r--
|
|
1713
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Sat May 10 14:15:07 2025 home/user
|
|
1714
|
+
[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
|
|
1715
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 12:49:04 2025 home/user/data/2025
|
|
1716
|
+
[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
|
|
1717
|
+
[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
|
|
1718
|
+
[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
|
|
1719
|
+
[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
|
|
1720
|
+
[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
|
|
1721
|
+
[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
|
|
1722
|
+
[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
|
|
1723
|
+
[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
|
|
1724
|
+
[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
|
|
1725
|
+
[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
|
|
1726
|
+
[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
|
|
1436
1727
|
```
|
|
1437
1728
|
|
|
1438
1729
|
## dar file selection examples
|
|
@@ -1453,26 +1744,26 @@ This happens when the shell splits the quoted string or interprets globs before
|
|
|
1453
1744
|
|
|
1454
1745
|
### select a directory
|
|
1455
1746
|
|
|
1456
|
-
Select files and sub directories in `home/
|
|
1747
|
+
Select files and sub directories in `home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling`
|
|
1457
1748
|
|
|
1458
1749
|
```bash
|
|
1459
|
-
dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-g 'home/
|
|
1750
|
+
dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-g 'home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling'"
|
|
1460
1751
|
```
|
|
1461
1752
|
|
|
1462
1753
|
gives
|
|
1463
1754
|
|
|
1464
1755
|
```text
|
|
1465
1756
|
...
|
|
1466
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1467
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1468
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1469
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1470
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1471
|
-
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x
|
|
1472
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1473
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1474
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1475
|
-
[Saved][ ] [-L-][ 1%][X] -rw-rw-r--
|
|
1757
|
+
[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
|
|
1758
|
+
[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
|
|
1759
|
+
[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
|
|
1760
|
+
[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
|
|
1761
|
+
[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
|
|
1762
|
+
[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
|
|
1763
|
+
[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
|
|
1764
|
+
[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
|
|
1765
|
+
[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
|
|
1766
|
+
[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
|
|
1476
1767
|
...
|
|
1477
1768
|
```
|
|
1478
1769
|
|
|
@@ -1485,15 +1776,15 @@ dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-I '*Z50*' -
|
|
|
1485
1776
|
gives something like
|
|
1486
1777
|
|
|
1487
1778
|
```text
|
|
1488
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
1489
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
1490
|
-
[Saved][-] [-L-][ 1%][ ] drwxrwxr-x
|
|
1491
|
-
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x
|
|
1492
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1493
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1494
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1495
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1496
|
-
[Saved][ ] [-L-][ 0%][X] -rw-rw-r--
|
|
1779
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Sat May 10 14:15:07 2025 home/user
|
|
1780
|
+
[Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 12:49:04 2025 home/user/data/2025
|
|
1781
|
+
[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
|
|
1782
|
+
[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
|
|
1783
|
+
[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
|
|
1784
|
+
[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
|
|
1785
|
+
[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
|
|
1786
|
+
[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
|
|
1787
|
+
[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
|
|
1497
1788
|
...
|
|
1498
1789
|
```
|
|
1499
1790
|
|
|
@@ -1524,9 +1815,9 @@ When restoring and using `/tmp` for --restore-dir, the restored files can be fou
|
|
|
1524
1815
|
|
|
1525
1816
|
### a single file
|
|
1526
1817
|
|
|
1527
|
-
```
|
|
1818
|
+
```bash
|
|
1528
1819
|
. <the virtual env>/bin/activate
|
|
1529
|
-
dar-backup --restore <archive_name> --selection
|
|
1820
|
+
dar-backup --restore <archive_name> --selection="-g path/to/file"
|
|
1530
1821
|
deactivate
|
|
1531
1822
|
```
|
|
1532
1823
|
|
|
@@ -1534,15 +1825,23 @@ deactivate
|
|
|
1534
1825
|
|
|
1535
1826
|
```bash
|
|
1536
1827
|
. <the virtual env>/bin/activate
|
|
1537
|
-
dar-backup --restore <archive_name> --selection
|
|
1828
|
+
dar-backup --restore <archive_name> --selection="-g path/to/directory"
|
|
1538
1829
|
deactivate
|
|
1539
1830
|
```
|
|
1540
1831
|
|
|
1541
1832
|
### .NEF from a specific date
|
|
1542
1833
|
|
|
1834
|
+
The backed up directory contains \*.NEF and \*.xmp files.
|
|
1835
|
+
|
|
1836
|
+
Filtering:
|
|
1837
|
+
|
|
1838
|
+
- Include files with "2024-06-16" in file name
|
|
1839
|
+
- Exclude files with file names ending in ".xmp"
|
|
1840
|
+
- Files must be in directory "home/user/tmp/LUT-play", compared to the file root (`-R`option) in the backup.
|
|
1841
|
+
|
|
1543
1842
|
```bash
|
|
1544
1843
|
. <the virtual env>/bin/activate
|
|
1545
|
-
dar-backup --restore <archive_name> --selection
|
|
1844
|
+
dar-backup --restore <archive_name> --selection="-I '*2024-06-16*' -X '*.xmp' -g home/user/tmp/LUT-play"
|
|
1546
1845
|
deactivate
|
|
1547
1846
|
```
|
|
1548
1847
|
|
|
@@ -1608,13 +1907,13 @@ One way to do that, is to let dar create a FULL archive from scratch, another is
|
|
|
1608
1907
|
I do backups of my homedir. Here it is shown how a FULL archive is merged with a DIFF, creating a new FULL archive.
|
|
1609
1908
|
|
|
1610
1909
|
```bash
|
|
1611
|
-
dar --merge
|
|
1910
|
+
dar --merge user-homedir_FULL_2021-09-12 -A user-homedir_FULL_2021-06-06 -@user-homedir_DIFF_2021-08-29 -s 12G
|
|
1612
1911
|
|
|
1613
1912
|
# test the new FULL archive
|
|
1614
|
-
dar -t
|
|
1913
|
+
dar -t user-homedir_FULL_2021-09-12
|
|
1615
1914
|
|
|
1616
1915
|
# create Par2 redundancy files
|
|
1617
|
-
for file in
|
|
1916
|
+
for file in user-homedir_FULL_yyyy-mm-dd.*.dar; do
|
|
1618
1917
|
par2 c -r5 -n1 "$file"
|
|
1619
1918
|
done
|
|
1620
1919
|
```
|
|
@@ -1639,6 +1938,8 @@ These [.darrc](#darrc) settings make `dar` print the current directory being pro
|
|
|
1639
1938
|
|
|
1640
1939
|
This is very useful in very long running jobs to get an indication that the backup is proceeding normally.
|
|
1641
1940
|
|
|
1941
|
+
The `dar` output is streamed to the `dar-backup-commands.log` file.
|
|
1942
|
+
|
|
1642
1943
|
### Separate log file for command output
|
|
1643
1944
|
|
|
1644
1945
|
Dar-backup's log file is called `dar-backup.log`.
|
|
@@ -1749,8 +2050,8 @@ Try auto completion in your session:
|
|
|
1749
2050
|
eval "$(register-python-argcomplete dar-backup)"
|
|
1750
2051
|
eval "$(register-python-argcomplete cleanup)"
|
|
1751
2052
|
eval "$(register-python-argcomplete manager)"
|
|
1752
|
-
complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
1753
|
-
complete -o nosort -C 'python -m argcomplete manager' manager
|
|
2053
|
+
#complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
2054
|
+
#complete -o nosort -C 'python -m argcomplete manager' manager
|
|
1754
2055
|
```
|
|
1755
2056
|
|
|
1756
2057
|
To make it persistent across sessions, add this to your ~/.bashrc:
|
|
@@ -1761,8 +2062,8 @@ eval "$(register-python-argcomplete dar-backup)"
|
|
|
1761
2062
|
eval "$(register-python-argcomplete cleanup)"
|
|
1762
2063
|
eval "$(register-python-argcomplete manager)"
|
|
1763
2064
|
# This disables bash sorting, so sorting is by <backup definition> and <date>
|
|
1764
|
-
complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
1765
|
-
complete -o nosort -C 'python -m argcomplete manager' manager
|
|
2065
|
+
#complete -o nosort -C 'python -m argcomplete cleanup' cleanup
|
|
2066
|
+
#complete -o nosort -C 'python -m argcomplete manager' manager
|
|
1766
2067
|
```
|
|
1767
2068
|
|
|
1768
2069
|
If you're using a virtual environment and register-python-argcomplete isn't in your global PATH, use:
|
|
@@ -1800,8 +2101,54 @@ Then reload Zsh:
|
|
|
1800
2101
|
source ~/.zshrc
|
|
1801
2102
|
```
|
|
1802
2103
|
|
|
2104
|
+
## Easy development setup
|
|
2105
|
+
|
|
2106
|
+
It is very easy to have your own development environment.
|
|
2107
|
+
|
|
2108
|
+
```bash
|
|
2109
|
+
git clone https://github.com/per2jensen/dar-backup.git
|
|
2110
|
+
cd dar-backup/v2
|
|
2111
|
+
./build.py
|
|
2112
|
+
```
|
|
2113
|
+
|
|
2114
|
+
This script:
|
|
2115
|
+
|
|
2116
|
+
- Creates a Python virtual environment called `venv`
|
|
2117
|
+
- pip install `hatch`
|
|
2118
|
+
- pip install the development environment as setup in pyproject.toml
|
|
2119
|
+
|
|
2120
|
+
--
|
|
2121
|
+
|
|
2122
|
+
```text
|
|
2123
|
+
dev = [
|
|
2124
|
+
"pytest",
|
|
2125
|
+
"wheel>=0.45.1",
|
|
2126
|
+
"requests>=2.32.2",
|
|
2127
|
+
"coverage>=7.8.2",
|
|
2128
|
+
"pytest>=8.4.0",
|
|
2129
|
+
"pytest-cov>=6.1.1",
|
|
2130
|
+
"psutil>=7.0.0",
|
|
2131
|
+
"pytest-timeout>=2.4.0",
|
|
2132
|
+
"httpcore>=0.17.3",
|
|
2133
|
+
"h11>=0.16.0",
|
|
2134
|
+
"zipp>=3.19.1",
|
|
2135
|
+
"anyio>=4.4.0",
|
|
2136
|
+
"black>=25.1.0"]
|
|
2137
|
+
```
|
|
2138
|
+
|
|
2139
|
+
✅ Your environment is now ready to activate and test!
|
|
2140
|
+
|
|
2141
|
+
Activate and run the test suite:
|
|
2142
|
+
|
|
2143
|
+
```bash
|
|
2144
|
+
source venv/bin/activate # activate the virtual env
|
|
2145
|
+
pytest # run the test suite
|
|
2146
|
+
```
|
|
2147
|
+
|
|
1803
2148
|
## Todo
|
|
1804
2149
|
|
|
2150
|
+
- Perhaps look into pre-processing backup definitions. As `dar` does not expand env vars
|
|
2151
|
+
`dar-backup` could do so and feed the result to `dar`.
|
|
1805
2152
|
- When run interactively, a progress bar during test and par2 generation would be nice.
|
|
1806
2153
|
- Look into a way to move the .par2 files away from the `dar` slices, to maximize chance of good redundancy.
|
|
1807
2154
|
- Add option to dar-backup to use the `dar` option `--fsa-scope none`
|
|
@@ -1835,7 +2182,7 @@ One backup definition per file
|
|
|
1835
2182
|
| [clean-log](#clean-log-options) | Clean up excessive log output from dar command logs |
|
|
1836
2183
|
| [dar-backup-systemd](#dar-backup-systemd-options) | Generate (and optionally install) systemd timers and services for automated backups |
|
|
1837
2184
|
| [installer](#installer-options) | Set up directories and optionally create catalog databases according to a config file |
|
|
1838
|
-
| [demo](#demo-options) | Set up required directories and
|
|
2185
|
+
| [demo](#demo-options) | Set up required directories and config files for a demo|
|
|
1839
2186
|
|
|
1840
2187
|
### test coverage
|
|
1841
2188
|
|
|
@@ -1966,10 +2313,12 @@ Sets up `dar-backup` according to provided config file.
|
|
|
1966
2313
|
The installer creates the necessary backup catalog databases if `--create-db` is given.
|
|
1967
2314
|
|
|
1968
2315
|
```bash
|
|
1969
|
-
--config
|
|
1970
|
-
--create-db
|
|
1971
|
-
-
|
|
1972
|
-
-
|
|
2316
|
+
--config Path to a config file. The configured directories will be created.
|
|
2317
|
+
--create-db Create backup catalog databases. Use this option with `--config`.
|
|
2318
|
+
--install-autocompletion Add bash or zsh auto completion - idempotent.
|
|
2319
|
+
--remove-autocompletion Remove the auto completion from bash or zsh.
|
|
2320
|
+
-v, --version Display version and licensing information.
|
|
2321
|
+
-h, --help Displays usage info.
|
|
1973
2322
|
```
|
|
1974
2323
|
|
|
1975
2324
|
### Demo options
|
|
@@ -1989,10 +2338,17 @@ Create directories:
|
|
|
1989
2338
|
Sets up demo config files:
|
|
1990
2339
|
|
|
1991
2340
|
- ~/.config/dar-backup/dar-backup.conf
|
|
1992
|
-
- ~/.config/dar-backup/backup.d/
|
|
2341
|
+
- ~/.config/dar-backup/backup.d/demo
|
|
1993
2342
|
|
|
1994
2343
|
```bash
|
|
1995
|
-
-i, --install
|
|
1996
|
-
-
|
|
1997
|
-
-
|
|
2344
|
+
-i, --install Sets up `dar-backup`.
|
|
2345
|
+
--root-dir Specify the root directory for the backup.
|
|
2346
|
+
--dir-to-backup Directory to backup, relative to the root directory.
|
|
2347
|
+
--backup-dir Directory where backups and redundancy files are put.
|
|
2348
|
+
--override By default, the script will not overwrite existing files or directories.
|
|
2349
|
+
Use this option to override this behavior.
|
|
2350
|
+
--generate Generate config files and put them in /tmp/ for inspection
|
|
2351
|
+
without writing to $HOME.
|
|
2352
|
+
-v, --version Display version and licensing information.
|
|
2353
|
+
-h, --help Displays usage info
|
|
1998
2354
|
```
|