Zum Inhalt springen

Duply: Unterschied zwischen den Versionen

Aus Foxwiki
K Textersetzung - „line>“ durch „line copy>“
 
(8 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 25: Zeile 25:


; Profilordner
; Profilordner
<syntaxhighlight lang="bash" highlight="1" line>
<syntaxhighlight lang="bash" highlight="1" line copy>
~/.duply/<profile>
~/.duply/<profile>
</syntaxhighlight>
</syntaxhighlight>
Zeile 52: Zeile 52:


== Installation ==
== Installation ==
<syntaxhighlight lang="bash" highlight="1" line>
<syntaxhighlight lang="bash" highlight="1" line copy>
sudo apt install duply
sudo apt install duply
</syntaxhighlight>
</syntaxhighlight>
Zeile 88: Zeile 88:
   man/man1/
   man/man1/
   duply.1.gz
   duply.1.gz
== Anwendung ==
<!--
; Erstmalige Verwendung (Profilerstellung)
<syntaxhighlight lang="bash" highlight="1" line>
duply <Profil> erstellen
</syntaxhighlight>
; Verwendung im Einzel- oder Batch-Modus
duply <profile> <Befehl>[[_|+|-]<Befehl>[_|+|-]...] [<Optionen> ...]
; Für Stapel können die bedingten Trennzeichen auch als Pseudo-Befehle geschrieben werden und(+), oder(-)
* siehe BEISPIELE
* siehe SEPARATORS
Nicht duply-Optionen werden an duplicity weitergegeben
* siehe OPTIONS
; Alle conf-Parameter können stattdessen auch in der Umgebung definiert werden
-->
=== Pre- und Post-Skripte ===
* Das pre-Skript wird direkt vor dem Backup ausgeführt, das post-Skript direkt nach dem Backup
* Mit diesen Skripten können beispielsweise Snapshots von LVM-Volumes oder Dumps von SQL Datenbanken gemacht und in das Backup einbezogen werden
* Die files <tt>pre</tt> und <tt>post</tt> müssen im jeweiligen duply Verzeichnis liegen (Bsp.: /home/user/.duply/backup/) und ausführbar sein
* Werden die pre/post Scripte nicht wie erhofft ausgeführt (beispielsweise bei den Sicherchungs-Methoden "full/incr"), können diese explizit angegeben werden: <tt>pre_incr_post</tt>
; Beispiel
Hier ein Beispiel für ein PRE/POST Skript welches vor dem Backup einen SQL-Dump aller Datenbanken erstellt und diesen nach dem Backup wieder löscht
; pre-Datei
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
/usr/bin/mysqldump --all-databases -u root -ppw > /tmp/sqldump-$(date '+%F')
; post-Datei
/bin/rm /tmp/sqldump-$(date '+%F')
; PRE/POST SCRIPTS
Useful internal duply variables are exported to the scripts
PROFILE, CONFDIR, SOURCE, TARGET_URL_<PROT|HOSTPATH|USER|PASS>,
GnuPG_<KEYS_ENC|KEY_SIGN|PW>, CMD_ERR, RUN_START,
CMD_<PREV|NEXT> (previous/next command),
CND_<PREV|NEXT> (condition before/after)
The CMD_* variables were introduced to allow different actions according to the command the scripts were attached to e.g. 'pre_bkp_post_pre_verify_post' will call the pre script two times, with CMD_NEXT variable set to 'bkp' on the first and to 'verify' on the second run
* CMD_ERR holds the exit code of the CMD_PREV
===exclude===
* duply arbeitet standardmäßig mit einer Whitelist
* Um gewisse Verzeichnisse oder Dateien von einem Backup zu inkludieren muss die Datei <tt>exclude</tt> im duply Verzeichnis erstellt werden
* Die Syntax erlaubt das Hinzufügen von Verzeichnissen und Dateien mit einem <tt>+ /pfad/zur/datei</tt>
* Um ein Verzeichnis zu exkludieren muss in der <tt>exclude</tt> ein <tt>- /pfad/zum/Verzeichnis</tt> eingefügt werden
* Zudem erlaubt duply die Verwendung von Wildcards
* Die hier dargestellte <tt>exclude</tt> Datei sichert die Verzeichnisse <tt>/etc/, /root/, /var/www/</tt> und exkludiert alle anderen Verzeichnisse
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
+ /etc/
+ /root/
+ /var/www/
- **
=== Argumente ===
* duply bietet eine Vielzahl von Kommandozeilenparametern für die Sicherung und Wiederherstellung von Daten
* Die gesamte Liste ist in der Manpage von duply zu finden
* Beim Einsatz von mehreren Parameter werden diese durch einen Unterstrich ('''_''') getrennt
* Mit <tt>/usr/bin/duply /root/.duply/test full_verify_purge --force</tt> wird ein volles Backup erstellt, verifiziert und alte Backups gelöscht
* Backups welche die <tt>MAX_AGE</tt> überschritten haben werden mit <tt>purge</tt> angezeigt und durch die zusätzliche Option <tt>--force</tt> gelöscht
* Der Befehl <tt>/usr/bin/duply /root/.duply/test incr</tt> führt ein inkrementelles Backup aus
===cronjob===
* Bei duply handelt es sich nicht um einen Dienst (Daemon), sondern um ein Skript, das beispielsweise regelmäßig via Cron ausgeführt werden kann
; Beispiel
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
0 0 * * 7 /usr/bin/duply /root/.duply/test full_verify_purge --force
0 0 * * 1-6 /usr/bin/duply /root/.duply/test incr
* In dieser Konfiguration wird Sonntags um 0:00 ein Full-Backup erstellt und alte Backups gelöscht
* Montag bis Samstag wird jeden Tag ein inkrementelles Backup durchgeführt
* Neue cronjobs können mit '''crontab -e''' erstellt werden
* Kommandos und Konfigurationsdateien müssen mit absolutem Pfad angegeben werden
=== Beispiele ===
==== Profil erstellen ====
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug create
don't forget to edit this new conf file
==== backup 'humbug' now ====
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug backup'''
==== available backup sets ====
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
list available backup sets of profile 'humbug'
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug status'''
==== outdated backups ====
; list and delete outdated backups of 'humbug'
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug purge --force'''
==== restore ====
; restore latest backup of 'humbug' to /mnt/restore
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug restore /mnt/restore'''
; restore /etc/passwd of 'humbug' from 4 days ago to /root/pw
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug fetch etc/passwd /root/pw 4D'''
$ '''(see "duplicity manpage", section TIME FORMATS)'''
==== a one line batch job on 'humbug' for cron execution ====
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug backup_verify_purge --force'''
==== batch job to run a full backup with pre/post scripts ====
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
$ '''duply humbug pre_full_post'''
=== Problembehebung ===
==== Volume was signed by key ''X'' not ''Y'' ====
==== OSError: Socket is closed ====
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>
ssh: Exception (client): Signature verification (ssh-rsa) failed
ssh: Traceback (most recent call last):
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/transport.py", line 2130, in run
ssh: self.kex_engine.parse_next(ptype, m)
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/kex_curve25519.py", line 64, in parse_next
ssh: return self._parse_kexecdh_reply(m)
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/kex_curve25519.py", line 130, in _parse_kexecdh_reply
ssh: self.transport._verify_key(peer_host_key_bytes, sig)
ssh: File "/usr/local/lib/python3.10/dist-packages/paramiko/transport.py", line 1942, in _verify_key
ssh: raise SSHException(
ssh: paramiko.ssh_exception.SSHException: Signature verification (ssh-rsa) failed
ssh:
Attempt of put Nr. 1 failed
* OSError: Socket is closed


== Aufruf ==
== Aufruf ==
=== Argumente ===
=== Argumente ===
=== Optionen ===
=== Optionen ===
{| class="wikitable sortable options"
{| class="wikitable options"
|-
|-
! Option !! Beschreibung
! Option !! Beschreibung
Zeile 329: Zeile 165:
=== Rückgabewert ===
=== Rückgabewert ===


=== SEPARATORS ===
{| class="wikitable sortable options"
|-
! Option !! !! Beschreibung
|-
| _ || underscore || neutral separator
|-
| + || plus sign, _and_ conditional AND || the next command will only be executed if the previous succeeded
|-
| - || minus sign, _or_ conditional OR || the next command will only be executed if the previous failed
|-
| [ ] || square brackets, _groupIn_/_groupOut_ || enables grouping of commands
|}


; Beispiel
<noinclude>
<syntaxhighlight lang="bash" highlight="1" line>
</syntaxhighlight>


'pre+[bkp-verify]_post'
translates to
'pre_and_groupIn_bkp_or_verify_groupOut_post'
=== TIME FORMATS ===
For all time related parameters like age, max_age und weitere Refer to the duplicity manpage for all available formats
; Beispiele
{| class="wikitable sortable options"
|-
! Option !! Beschreibung
|-
| 2002-01-25T07:00:00+02:00 || full date time format string
|-
| 2002/3/5 || date string YYYY/MM/DD
|-
| 12D || interval, 12 days ago
|-
| 1h78m || interval, 1 hour 78 minutes ago
|}
== Sicherheit ==
; Kopieren Sie den ''gesamten'' Profilordner nach der ersten Sicherung an einen sicheren Ort
* Er enthält alles, was für die Wiederherstellung Ihrer Backups benötigt wird (in doppelter Hinsicht)
Achten Sie auf (möglicherweise später hinzugefügte) externe Dateien wie Credentials oder Auth-Dateien (beispielsweise netrc, .megarc, ssh-Schlüssel) oder Umgebungsvariablen (beispielsweise DPBX_ACCESS_TOKEN)
Es ist ratsam, diese im Profilordner zu platzieren, wenn dies überhaupt möglich ist
* beispielsweise im Falle eines 'multi://' Ziels sollte die config .json Datei Env vars zur conf Datei der Duply Profile hinzugefügt werden
Halten Sie den Zugriff auf diese Dateien beschränkt, da sie Informationen (gpg-Schlüssel, Passphrasen und weitere) für den Zugriff und die Änderung Ihrer Backups enthalten
; Zusammenfassung
* Versuchen Sie eine Wiederherstellung von einem anderen Rechner aus, um sicherzustellen, dass Sie wirklich alles haben, was Sie für die Wiederherstellung benötigen
* Wiederholen Sie diese Schritte nach _allen_ Konfigurationsänderungen
* Einige Konfigurationsoptionen sind für die Wiederherstellung entscheidend
<noinclude>
== Anhang ==
== Anhang ==
=== Siehe auch ===
=== Siehe auch ===
Zeile 403: Zeile 187:
# [https://duply.net/ duply.net]
# [https://duply.net/ duply.net]


[[Kategorie:Linux/Backup]]
[[Kategorie:duply]]


{{DISPLAYTITLE:duply}}
{{DISPLAYTITLE:duply}}


</noinclude>
</noinclude>
[[Kategorie:Linux/Befehl]]

Aktuelle Version vom 11. Mai 2025, 13:42 Uhr

duply - Inkrementelle verschlüsselte Backups

Beschreibung

Frontend für duplicity

Shell-Frontend für duplicity

  • Verwendung vereinfachen
  • Einstellungen in Profilen verwalten
  • Stapelverarbeitung
    • Es unterstützt die Ausführung von mehreren Befehlen als Stapelverarbeitung
    • Damit sind einzeilige cron-Einträge möglich und der Benutzer kann Skripte verwenden, die vor oder nach dem Backup ausgeführt werden
  • Alle duplicity-Backends werden unterstützt
Vereinfacht die Ausführung von Duplicity

Frontend für duplicity

  • Backups können lokal oder einem anderen System gespeichert werden
  • Cron oder Kommandozeile
  • Speichert Einstellungen in Profilen
  • Batch-Operationen
    ermöglicht, beispielsweise backup_verify+purge
  • Ausführung von Pre-/Post-Skripten
  • verschiedene Aktionen möglich, abhängig vom vorherigen oder nächsten Befehl oder dessen Rückgabewert
  • Vorbedingungsprüfung für fehlerfreie Duplizitätsoperationen

Für jeden Sicherungsauftrag wird ein Konfigurationsprofil erstellt

Profilordner
~/.duply/<profile>
Hinweis
Wenn der Ordner '/etc/duply' existiert, werden die Profile für den Superuser Benutzer root dort gesucht und erstellt werden
Protokolle
Protokoll Beschreibung
ftp
ssh
s3
rsync
cifs
webdav
http

Installation

sudo apt install duply

Dateien

/usr/bin/
duply
/usr/share
/doc/duply/
 README
 README.Debian
 TODO
 changelog.Debian.gz
 changelog.gz
 copyright
 systemd-unit.examples
  HOWTO.txt
  systemd-unit.examples/system/
   duply-backup@.service
   duply-backup@.timer
   duply-cleanup@.service
   duply-cleanup@.timer
   duply-verify@.service
   duply-verify@.timer
   notify-failed-backup@.service
  systemd-unit.examples/user/
   duply-backup@.service
   duply-backup@.timer
   duply-cleanup@.service
   duply-cleanup@.timer
   duply-verify@.service
   duply-verify@.timer
   notify-failed-backup@.service
 man/man1/
  duply.1.gz

Aufruf

Argumente

Optionen

Option Beschreibung
--force passed to duplicity (see commands purge, purgeFull, purgeIncr, cleanup)
--preview do nothing but print out generated duplicity command lines
--disable-encryption disable encryption, overrides profile settings

Kommandos

Option Parameter Beschreibung
usage get usage help text
and/or/groupIn/groupOut pseudo commands used in batches (see SEPARATORS above)
create creates a configuration profile
backup backup with pre/post script execution (batch: [pre_bkp_post]), full (if full_if_older matches or no earlier backup is found) incremental (in all other cases)
pre/post execute '<profile>/pre', '<profile>/post' scripts
bkp as above but without executing pre/post scripts
full force full backup
incr force incremental backup
list [<age>] list all files in backup (as it was at <age>, default: now)
status prints backup sets and chains currently in repository
verify [<age>] [--compare-data] list files changed, since age if given
verifyPath <rel_path_in_bkp> <local_path> [<age>] [--compare-data] list changes of a file or folder path in backup compared to a local path, since age if given
restore <target_path> [<age>] restore the complete backup to <target_path> [as it was at <age>]
fetch <src_path> <target_path> [<age>] fetch single file/folder from backup [as it was at <age>]
purge [<max_age>] [--force] list outdated backup files (older than $MAX_AGE) [use --force to actually delete these files]
purgeFull [<max_full_backups>] [--force] list outdated backup files ($MAX_FULL_BACKUPS being the number of full backups and associated incrementals to keep, counting in reverse chronological order) [use --force to actually delete these files]
purgeIncr [<max_fulls_with_incrs>] [--force] list outdated incremental backups ($MAX_FULLS_WITH_INCRS being the number of full backups which associated incrementals will be kept, counting in reverse chronological order) [use --force to actually delete these files]
purgeAuto [--force] convenience batch wrapper for all purge commands above
  • purge, purgeFull, purgeIncr are added if their conf vars were set
  • e.g
MAX_AGE=1Y
MAX_FULL_BACKUPS=6
MAX_FULLS_WITH_INCR=3

in profile conf file would result in

[purge_purgeFull_purgeIncr]
cleanup [--force] list broken backup chain files archives (e.g
  • after unfinished run) [use --force to actually delete these files]
changelog print changelog / todo list
txt2man feature for package maintainers - create a manpage based on the usage output
version show version information of duply and needed programs

Umgebung

Rückgabewert

Anhang

Siehe auch


Sicherheit

Dokumentation

Links

Projekt

Weblinks

  1. https://www.thomas-krenn.com/de/wiki/Backup_unter_Linux_mit_duply
  2. https://wiki.archlinux.org/index.php/Duply#Configuration
  3. https://www.gnupg.org/howtos/de/GnuPGMiniHowto.html
  4. duply.net