Duply: Unterschied zwischen den Versionen

Aus Foxwiki
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(111 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
{{DISPLAYTITLE:duply}}
{{DISPLAYTITLE:duply}}
'''duply''' erstellt inkrementelle verschlüsselte Backups
'''duply''' - Inkrementelle verschlüsselte Backups erstellen


= Beschreibung =
== Beschreibung ==
* Frontend für [https://de.wikipedia.org/wiki/Duplicity_(Software) duplicity].
; Vereinfacht die Ausführung von Duplicity
* Backups können lokal oder einem anderen System gespeichert werden.
* Frontend für [[duplicity]]
* Unterstützte Protokolle: <tt>ftp, ssh, s3, rsync, cifs, webdav, http</tt>.
* Backups können lokal oder einem anderen System gespeichert werden
* Cron oder Kommandozeile
* Speichert Einstellungen in Profilen
* Batch-Operationen
*: ermöglicht, z.&nbsp;B.&nbsp;backup_verify+purge
* Ausführung von Pre-/Post-Skripten
* verschiedene Aktionen möglich, abhängig vom vorherigen oder nächsten Befehl oder dessen Exit-Status
* Vorbedingungsprüfung für fehlerfreie Duplizitätsoperationen


= Installation =
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
* ftp
* ssh
* s3
* rsync
* cifs
* webdav
* http
 
== Installation ==
  # apt install duply
  # apt install duply


= Syntax =
== Konfiguration ==
== Parameter ==
=== Kryptografie ===
== Optionen ==
siehe [[GnuPG#Schl.C3.BCssel_erstellen|GnuPG:Schlüssel erstellen]]
== Umgebungsvariablen ==
== Exit-Status ==


= Konfiguration =
=== Profile ===
= Konfiguration =
* Indicated by a path or a profile name (<profile>), which is resolved to '~/.duply/<profile>' (~ expands to environment variable $HOME).
== Verschlüsselung konfigurieren ==
* Superuser root can place profiles under '/etc/duply'. Simply create the folder manually before running duply as superuser.
=== Schlüssel erstellen ===
siehe [[GPG#Schl.C3.BCssel_erstellen|GPG]]


== Profil erstellen ==
; Note
: Already existing profiles in root's home folder will cease to work unless they are moved to the new location manually.
 
; Example 1
duply humbug backup
 
Alternatively a _path_ might be used e.g. useful for quick testing, restoring or exotic locations. Shell expansion should work as usual.
 
; Hint
:The path must contain at least one path separator '/', e.g. './test' instead of only 'test'.
 
; Example 2
: duply ~/.duply/humbug backup
 
==== Profil erstellen ====
  # duply <backupname> create
  # duply <backupname> create


Ein duply-Profil wird im Home-Verzeichnis des Benutzers unter '''~/.duply/''' angelegt und besteht aus den folgenden Dateien:  
Ein duply-Profil wird im Home-Verzeichnis des Benutzers unter '''~/.duply/''' angelegt und besteht aus den folgenden Dateien:
* gpg-key.asc (nur wenn ein gpg-key exportiert wurde.)
* gpg-key.asc (nur wenn ein gpg-key exportiert wurde)
* conf  
* conf
* pre und post  
* pre und post
* exclude
* exclude


== Konfiguration ==
=== Konfiguration ===
=== Verschlüsselung einrichten===
==== Kryptografie einrichten====
====Voraussetzung====
=====Voraussetzung=====
Key-ID und das Passwort des GPG-Keys müssen dafür hinterlegt werden.
Key-ID und das Passwort des GnuPG-Keys müssen dafür hinterlegt werden
 
  GnuPG_KEY='_GnuPG_KEY_ID_'
  GPG_KEY='_GPG_KEY_ID_'
  GnuPG_PW='_GnuPG_PASSWORD_'
  GPG_PW='_GPG_PASSWORD_'


====Key-ID anzeigen lassen====
=====Key-ID anzeigen lassen=====
Private-Key
; Private-Key
gpg --list-secret-keys --keyid-format LONG
 
Konsole
  # gpg --list-secret-keys --keyid-format LONG
  # gpg --list-secret-keys --keyid-format LONG
  gpg: "Trust-DB" wird überprüft
  gpg: "Trust-DB" wird überprüft
Zeile 55: Zeile 84:
  uid              [ ultimativ ] Robert Quies (Es grünt so grün, wenn  Spaniens Blüten blühn.) <raqju@web.de>
  uid              [ ultimativ ] Robert Quies (Es grünt so grün, wenn  Spaniens Blüten blühn.) <raqju@web.de>
  ssb  rsa4096/B2E20485FF7FC772 2020-11-04 [E] [verfällt: 2021-11-04]
  ssb  rsa4096/B2E20485FF7FC772 2020-11-04 [E] [verfällt: 2021-11-04]
Public-Key
# gpg --list-keys --keyid-format LONG


Konsole
  # gpg --list-keys --keyid-format LONG
  # gpg --list-keys --keyid-format LONG
  /root/.gnupg/pubring.kbx
  /root/.gnupg/pubring.kbx
Zeile 68: Zeile 93:
  sub  rsa4096/B2E20485FF7FC772 2020-11-04 [E] [verfällt: 2021-11-04]
  sub  rsa4096/B2E20485FF7FC772 2020-11-04 [E] [verfällt: 2021-11-04]


===Kompression und Art der Verschlüsselung festlegen===
====Kompression und Kryptografie ====
Zusätzlich können in '''GPG_OPTS=''' weitere Optionen zur Kompression und Art der Verschlüsselung gesetzt werden.
; GnuPG_OPTS
*Es soll mit dem freien Komprimierungsprogramm '''bzip2''' komprimiert werden und dem symmetrischen Verschlüsselungsverfahren '''A'''dvanced '''E'''ncryption '''S'''tandard, auch Rijndael-Algorithmus genannt, mit einer Schlüssellänge von '''256''' verschlüsselt werden.
Optionen zur Kompression und Art der Kryptografie
GPG_OPTS='--compress-algo=bzip2 --personal-cipher-preferences AES256'
* '''bzip2''' komprimiert
* '''A'''dvanced '''E'''ncryption '''S'''tandard, auch Rijndael-Algorithmus mit einer Schlüssellänge von '''256''' werden


=== De-/Aktivieren der Überprüfung GPG-Key und GPG-Passphrase ===
GnuPG_OPTS='--compress-algo=bzip2 --personal-cipher-preferences AES256'
* duply prüft vor jeder Aktion ob der GPG-Key gültig ist und die Passphrase korrekt ist.
* Dies kann durch die Option '''GPG_TEST='disabled'''' unterbunden werden.


Aktiviert
==== Prüfen der GnuPG-Key und GnuPG-Passphrase ====
GPG_TEST='disabled'
; De-/Aktivieren der Überprüfung GnuPG-Key und GnuPG-Passphrase
* duply prüft vor jeder Aktion ob der GnuPG-Key gültig ist und die Passphrase korrekt ist.
* Dies kann durch die Option '''GnuPG_TEST='disabled'''' unterbunden werden.


Deaktiviert
; Aktiviert
  # GPG_TEST='disabled'
  GnuPG_TEST='disabled'


===Ziel und Quelle des Backups festlegen===
; Deaktiviert
====Allgemeine Syntax des hosts====
# GnuPG_TEST='disabled'
 
==== Ziel und Quelle des Backups ====
; Allgemeine Syntax des hosts
  scheme://[user:password@]host[:port]/[/]path
  scheme://[user:password@]host[:port]/[/]path


====Protokolle und Syntax zur Datenübertragung====
; Protokolle und Syntax zur Datenübertragung
* duply versteht alle gängigen Protokolle zur Datenübertragung.
* duply versteht alle gängigen Protokolle zur Datenübertragung
* In der conf-Datei befindet sich meistens eine Liste der wichtigsten unterstützten Protokolle und deren Syntax.
* In der conf-Datei befindet sich meistens eine Liste der wichtigsten unterstützten Protokolle und deren Syntax


  file://[/absolute_]path
  file://[/absolute_]path
Zeile 104: Zeile 133:
  s3+http://[user:password]@bucket_name[/prefix]
  s3+http://[user:password]@bucket_name[/prefix]
  scp and sftp are aliases for the ssh backend
  scp and sftp are aliases for the ssh backend
  ssh://user</nowiki>[:password]@other.host[:port]/some_dir
  ssh://user<nowiki>&lt;/nowiki&gt;</nowiki>[:password]@other.host[:port]/some_dir
  tahoe://alias/directory
  tahoe://alias/directory
  webdav[s]://user[:password]@other.host/some_dir
  webdav[s]://user[:password]@other.host/some_dir


'''Hinweis'''
; Hinweis
Sonderzeichen müssen [https://de.wikipedia.org/wiki/URL-Encoding urlencoded] eingetragen werden, außer bei den Parametern '''TARGET_USER, TARGET_PASS'''
: Sonderzeichen müssen [https://de.wikipedia.org/wiki/URL-Encoding urlencoded] eingetragen werden, außer bei den Parametern '''TARGET_USER, TARGET_PASS'''


====Ziel des Backups festlegen====
; Ziel des Backups
  TARGET='scheme://user[:password]@host[:port]/[/]path'
  TARGET='scheme://user[:password]@host[:port]/[/]path'


*Es soll das Protokoll '''ssh''' zur Datenübertragung genutzt werden.  
* Es soll das Protokoll '''ssh''' zur Datenübertragung genutzt werden.
*Username: '''user'''
* Username: '''user'''
*Passwort: '''KohlIstKrempe969'''
* Passwort: '''KohlIstKrempe969'''
*Host: '''foxtom.net'''
* Host: '''foxtom.net'''
*Port: '''22'''
* Port: '''22'''
*Pfad: '''home/user/backup_PC1'''
* Pfad: '''home/user/backup_PC1'''


  TARGET='<nowiki>ssh://user:KohlIstKrempe969@foxtom.net:22/home/user/backup_PC1</nowiki>'
  TARGET='<nowiki>ssh://user:KohlIstKrempe969@foxtom.net:22/home/user/backup_PC1</nowiki>'


====Quelle des Backups festlegen====
; Quelle des Backups
Root-Verzeichnis für das Backup setzen.
Root-Verzeichnis für das Backup setzen
  SOURCE=
  SOURCE=


Soll ein Backup aus mehreren Unterordnern von '''/''' bestehen (Bsp.: /etc /var /home sollen gesichert werden), so muss die SOURCE Variable auf '''/''' gesetzt werden.''  
Soll ein Backup aus mehreren Unterordnern von '''/''' bestehen (Bsp.: /etc /var /home sollen gesichert werden), so muss die SOURCE Variable auf '''/''' gesetzt werden.''
  SOURCE='/'
  SOURCE='/'


In der Regel wird SOURCE='/' gesetzt.  
In der Regel wird SOURCE='/' gesetzt.


Dateien, die in die Sicherung aufgenommen oder von ihr ausgeschlossen werden, werden in der Datei [[Backup:duply#exclude|'''exclude''']] angegeben.
Dateien, die in die Sicherung aufgenommen oder von ihr ausgeschlossen werden, werden in der Datei [[Backup:duply#exclude|'''exclude''']] angegeben.


===Maximales Alter eines Backups festlegen===
==== Maximales Alter eines Backups ====
Hier ist anzumerken, dass duply keine Backups löscht, sofern man es nicht anfordert.
; Hinweis
: ''duply'' löscht keine Backups, sofern man es nicht anfordert


Mit '''MAX_AGE''' wird das maximale Alter von Backups bestimmt.
Mit '''MAX_AGE''' wird das maximale Alter von Backups bestimmt.
Zeile 141: Zeile 171:
  MAX_AGE=1Y
  MAX_AGE=1Y


===Anzahl der vollständigen Backups festlegen===
====Anzahl der vollständigen Backups ====
Mit '''MAX_FULL_BACKUPS''' kann bestimmt werden, wie viele Full-Backups duply maximal behält.
Mit '''MAX_FULL_BACKUPS''' kann bestimmt werden, wie viele Full-Backups duply maximal behält.


Es sollen fünf sein.  
Es sollen fünf sein.
  MAX_FULL_BACKUPS=5
  MAX_FULL_BACKUPS=5


===Maximales Alter der vollständigen Backups festlegen===
==== Maximales Alter der vollständigen Backups ====
Alternativ kann mit '''MAX_FULLBKP_AGE''' spezifiert werden, wie alt ein Full-Backup sein darf, bevor ein neues Full-Backup erstellt wird.  
Alternativ kann mit '''MAX_FULLBKP_AGE''' spezifiert werden, wie alt ein Full-Backup sein darf, bevor ein neues Full-Backup erstellt wird.


Es soll zwei Wochen alt sein.
Es soll zwei Wochen alt sein.
Zeile 154: Zeile 184:
  DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE"
  DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE"


=== Größe der Backup-Pakete bei der Übertragung ändern ===
==== Größe der Backup-Pakete ====
Um den durch eventuelle Übertragungsfehler entstehenden Zeitverlust einzuschränken, teilt duply standardmäßig seine Backups in 25 MB große Dateien. Mit '''VOLSIZE''' kann die Größe der erstellten Backup-Pakete geändert werden.


Um den durch eventuelle Übertragungsfehler entstehenden Zeitverlust einzuschränken, teilt duply standardmäßig seine Backups in 25 MB große Dateien.  
Der gewünschte Wert hängt von verschieden Faktoren ab.
* Übertragungsgeschwindigkeit
* Systembelastung
* Netzwerkbelastung


Dies kann mit '''VOLSIZE''' geändert werden.
Vor-/Nachteile
 
* Vorteil kleine Pakete
Backup-Pakete sollen 10 MB groß sein.
* Vorteil große Pakete
* Nachteil kleine Pakete
* Nachteil große Pakete


;Beispiel
Backup-Pakete sollen 10 MB groß sein
  VOLSIZE=10
  VOLSIZE=10
  DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE"
  DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE"


== Dateien ==
==== Asynchrone Uploads ====
Asynchrone Uploads erlauben das Erstellen neuer Archive, bevor bereits erstellte auf den Server geladen wurden.
* Schnelleres Backup
* Hohe System- und hohe Netzlast
 
Asynchrone Uploads aktivieren
DUPL_PARAMS="$DUPL_PARAMS --asynchronous-upload"
 
=== Dateien ===
; Profile folder
{| class="wikitable sortable options"
|-
! Option !! Beschreibung
|-
| /etc/duply ||
|-
| ~/.duply/<profile> ||
|}
 
; Profile files
{| class="wikitable sortable options"
|-
! Option !! Beschreibung
|-
| conf || profile configuration file
|-
| pre,post || pre/post scripts (see above for details)
|-
| gpgkey.*.asc || exported GnuPG key files
|-
| exclude ||a globbing list of included or excluded files/folders (see "duplicity manpage", section FILE SELECTION)
|}
 
== Anwendung ==
; Erstmalige Verwendung (Profilerstellung)
  duply <Profil> erstellen
 
; 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


= Anwendungen =
==== Anwendung ====
=== Anwendung ===
  '''GnuPG_KEY='C676563899DE35FA''''
  '''GPG_KEY='C676563899DE35FA''''
  '''GnuPG_PW='NerzManta9''''
  '''GPG_PW='NerzManta9''''
  '''GnuPG_OPTS='--compress-algo=bzip2 --personal-cipher-preferences AES256''''
  '''GPG_OPTS='--compress-algo=bzip2 --personal-cipher-preferences AES256''''  
  '''GnuPG_TEST='disabled''''
  '''GPG_TEST='disabled''''
  '''TARGET='<nowiki>ssh://user:KohlIstKrempe969@foxtom.net:22/home/user/backup_PC1</nowiki>''''
  '''TARGET='<nowiki>ssh://user:KohlIstKrempe969@foxtom.net:22/home/user/backup_PC1</nowiki>''''
  '''SOURCE='/''''
  '''SOURCE='/''''
Zeile 178: Zeile 262:
  '''MAX_FULL_BACKUPS=5'''
  '''MAX_FULL_BACKUPS=5'''
  '''MAX_FULLBKP_AGE=2W'''
  '''MAX_FULLBKP_AGE=2W'''
  '''DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE"'''  
  '''DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE"'''
  '''VOLSIZE=10'''
  '''VOLSIZE=10'''
  '''DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE"'''
  '''DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE"'''


==Pre- und Post-Skripte==
=== Pre- und Post-Skripte ===
* duply erlaubt die Verwendung von Pre- und Post-Skripten.
* Das pre-Skript wird direkt vor dem Backup ausgeführt, das post-Skript direkt nach dem Backup.
* 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.
* 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.
* 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 (z.&nbsp;B.&nbsp;bei den Sicherchungs-Methoden "full/incr"), können diese explizit angegeben werden: <tt>pre_incr_post</tt>
* Werden die pre/post Scripte nicht wie erhofft ausgeführt (z.B. bei den Sicherchungs-Methoden "full/incr"), können diese explizit angegeben werden: <tt>pre_incr_post</tt>  


; Beispiel
; 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.  
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
; pre-Datei
  /usr/bin/mysqldump --all-databases -u root -ppw> /tmp/sqldump-$(date '+%F')
  /usr/bin/mysqldump --all-databases -u root -ppw > /tmp/sqldump-$(date '+%F')


; post-Datei
; post-Datei
  /bin/rm /tmp/sqldump-$(date '+%F')
  /bin/rm /tmp/sqldump-$(date '+%F')


==exclude==
; PRE/POST SCRIPTS
* duply arbeitet standardmäßig mit einer Whitelist.  
Useful internal duply variables are exported to the scripts
* 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>.  
PROFILE, CONFDIR, SOURCE, TARGET_URL_<PROT|HOSTPATH|USER|PASS>,
* Um ein Verzeichnis zu exkludieren muss in der <tt>exclude</tt> ein <tt>- /pfad/zum/Verzeichnis</tt> eingefügt werden.  
GnuPG_<KEYS_ENC|KEY_SIGN|PW>, CMD_ERR, RUN_START,
* Zudem erlaubt duply die Verwendung von Wildcards.  
CMD_<PREV|NEXT> (previous/next command),
* Die hier dargestellte <tt>exclude</tt> Datei sichert die Verzeichnisse <tt>/etc/, /root/, /var/www/</tt> und exkludiert alle anderen Verzeichnisse.  
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.
  + /etc/
  + /etc/
  + /root/
  + /root/
Zeile 210: Zeile 303:
  - **
  - **


== Parameter ==
=== Parameter ===
* duply bietet eine Vielzahl von Kommandozeilenparametern für die Sicherung und Wiederherstellung von Daten.  
* 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.  
* Die gesamte Liste ist in der Manpage von duply zu finden.
* Beim Einsatz von mehreren Parameter werden diese durch einen Unterstrich ('''_''') getrennt.  
* 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.  
* 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.  
* 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.
* Der Befehl <tt>/usr/bin/duply /root/.duply/test incr</tt> führt ein inkrementelles Backup aus.


==cronjob==
===cronjob===
* Bei duply handelt es sich nicht um einen Dienst (Daemon), sondern um ein Skript, das z.B. regelmäßig via Cron ausgeführt werden kann.  
* Bei duply handelt es sich nicht um einen Dienst (Daemon), sondern um ein Skript, das z.&nbsp;B.&nbsp;regelmäßig via Cron ausgeführt werden kann.


; Beispiel
; Beispiel
Zeile 225: Zeile 318:
  0 0 * * 1-6 /usr/bin/duply /root/.duply/test incr
  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.  
* 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.  
* Montag bis Samstag wird jeden Tag ein inkrementelles Backup durchgeführt.
* Neue cronjobs können mit '''crontab -e''' erstellt werden.  
* Neue cronjobs können mit '''crontab -e''' erstellt werden.
* Kommandos und Konfigurationsdateien müssen mit absolutem Pfad angegeben werden.
* Kommandos und Konfigurationsdateien müssen mit absolutem Pfad angegeben werden.


= Fehlerbehebung =
=== Beispiele ===
== Volume was signed by key ''X'' not ''Y'' ==
==== Profil erstellen  ====
$ '''duply humbug create
don't forget to edit this new conf file
 
==== backup 'humbug' now ====
$ '''duply humbug backup'''
 
==== available backup sets ====
list available backup sets of profile 'humbug'
$ '''duply humbug status'''


= Sicherheit =
==== outdated backups ====
= Dokumentation =
; list and delete outdated backups of 'humbug'
== RFC ==
== Man-Pages ==
== Info-Pages ==
== Projekt-Homepage ==


= Links =
$ '''duply humbug purge --force'''
== Siehe auch ==
# [[GPG]]
# [[GPG-Agent]]
# [[pinentry-curses]]


== Weblinks ==
==== restore ====
; restore latest backup of 'humbug' to /mnt/restore
$ '''duply humbug restore /mnt/restore'''
 
; restore /etc/passwd of 'humbug' from 4 days ago to /root/pw
$ '''duply humbug fetch etc/passwd /root/pw 4D'''
$ '''(see "duplicity manpage", section TIME FORMATS)'''
 
==== a one line batch job on 'humbug' for cron execution ====
$ '''duply humbug backup_verify_purge --force'''
 
==== batch job to run a full backup with pre/post scripts ====
$ '''duply humbug pre_full_post'''
 
=== Fehlerbehebung ===
==== Volume was signed by key ''X'' not ''Y'' ====
==== OSError: Socket is closed ====
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
 
== Syntax ==
=== Parameter ===
=== Optionen ===
{| class="wikitable sortable options"
|-
! 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 ===
{| class="wikitable sortable options"
|-
! 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. download txt2man from http://mvertes.free.fr/, put it in the PATH and run 'duply txt2man' to create a man page.
|-
| version || || show version information of duply and needed programs
|}
 
=== Umgebungsvariablen ===
=== Exit-Status ===
 
=== 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
'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 etc. 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 (z.&nbsp;B.&nbsp;netrc, .megarc, ssh-Schlüssel) oder Umgebungsvariablen (z.&nbsp;B.&nbsp;DPBX_ACCESS_TOKEN).
 
Es ist ratsam, diese im Profilordner zu platzieren, wenn dies überhaupt möglich ist. z.&nbsp;B.&nbsp;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 usw.) 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 ==
=== Siehe auch ===
{{Special:PrefixIndex/{{BASEPAGENAME}}}}
----
* [[GnuPG]]
* [[GnuPG-Agent]]
* [[pinentry-curses]]
* [[duplicity]]
 
==== Sicherheit ====
==== Dokumentation ====
==== Links ====
===== Projekt =====
===== Weblinks =====
# [https://www.thomas-krenn.com/de/wiki/Backup_unter_Linux_mit_duply https://www.thomas-krenn.com/de/wiki/Backup_unter_Linux_mit_duply]
# [https://www.thomas-krenn.com/de/wiki/Backup_unter_Linux_mit_duply https://www.thomas-krenn.com/de/wiki/Backup_unter_Linux_mit_duply]
# [https://wiki.archlinux.org/index.php/Duply#Configuration https://wiki.archlinux.org/index.php/Duply#Configuration]
# [https://wiki.archlinux.org/index.php/Duply#Configuration https://wiki.archlinux.org/index.php/Duply#Configuration]
# [https://www.gnupg.org/howtos/de/GPGMiniHowto.html https://www.gnupg.org/howtos/de/GPGMiniHowto.html]
# [https://www.gnupg.org/howtos/de/GnuPGMiniHowto.html https://www.gnupg.org/howtos/de/GnuPGMiniHowto.html]
# [http://duply.net/ duply.net]  
# [http://duply.net/ duply.net]
 
== Einzelnachweise ==
<references />
 
= Testfragen =
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 1''
<div class="mw-collapsible-content">'''Antwort1'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 2''
<div class="mw-collapsible-content">'''Antwort2'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 3''
<div class="mw-collapsible-content">'''Antwort3'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 4''
<div class="mw-collapsible-content">'''Antwort4'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 5''
<div class="mw-collapsible-content">'''Antwort5'''</div>
</div>


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

Aktuelle Version vom 2. März 2024, 12:53 Uhr

duply - Inkrementelle verschlüsselte Backups erstellen

Beschreibung

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, z. B. backup_verify+purge
  • Ausführung von Pre-/Post-Skripten
  • verschiedene Aktionen möglich, abhängig vom vorherigen oder nächsten Befehl oder dessen Exit-Status
  • 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
  • ftp
  • ssh
  • s3
  • rsync
  • cifs
  • webdav
  • http

Installation

# apt install duply

Konfiguration

Kryptografie

siehe GnuPG:Schlüssel erstellen

Profile

  • Indicated by a path or a profile name (<profile>), which is resolved to '~/.duply/<profile>' (~ expands to environment variable $HOME).
  • Superuser root can place profiles under '/etc/duply'. Simply create the folder manually before running duply as superuser.
Note
Already existing profiles in root's home folder will cease to work unless they are moved to the new location manually.
Example 1
duply humbug backup

Alternatively a _path_ might be used e.g. useful for quick testing, restoring or exotic locations. Shell expansion should work as usual.

Hint
The path must contain at least one path separator '/', e.g. './test' instead of only 'test'.
Example 2
duply ~/.duply/humbug backup

Profil erstellen

# duply <backupname> create

Ein duply-Profil wird im Home-Verzeichnis des Benutzers unter ~/.duply/ angelegt und besteht aus den folgenden Dateien:

  • gpg-key.asc (nur wenn ein gpg-key exportiert wurde)
  • conf
  • pre und post
  • exclude

Konfiguration

Kryptografie einrichten

Voraussetzung

Key-ID und das Passwort des GnuPG-Keys müssen dafür hinterlegt werden

GnuPG_KEY='_GnuPG_KEY_ID_'
GnuPG_PW='_GnuPG_PASSWORD_'
Key-ID anzeigen lassen
Private-Key
# gpg --list-secret-keys --keyid-format LONG
gpg: "Trust-DB" wird überprüft
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: Tiefe: 0  gültig:   1  signiert:   0  Vertrauen: 0-, 0q, 0n, 0m,  0f, 1u
gpg: nächste "Trust-DB"-Pflichtüberprüfung am 2021-11-04
/root/.gnupg/pubring.kbx
------------------------
sec   rsa4096/F47E1B7450082D11 2020-11-04 [SC] [verfällt: 2021-11-04]
      60E3D3C9ED78CE4A40322BBAF47E1B7450082D11
uid              [ ultimativ ] Robert Quies (Es grünt so grün, wenn  Spaniens Blüten blühn.) <raqju@web.de>
ssb   rsa4096/B2E20485FF7FC772 2020-11-04 [E] [verfällt: 2021-11-04]
# gpg --list-keys --keyid-format LONG
/root/.gnupg/pubring.kbx
------------------------
pub   rsa4096/F47E1B7450082D11 2020-11-04 [SC] [verfällt: 2021-11-04]
      60E3D3C9ED78CE4A40322BBAF47E1B7450082D11
uid              [ ultimativ ] Robert Quies (Es grünt so grün, wenn Spaniens Blüten blühn.) <raqju@web.de>
sub   rsa4096/B2E20485FF7FC772 2020-11-04 [E] [verfällt: 2021-11-04]

Kompression und Kryptografie

GnuPG_OPTS

Optionen zur Kompression und Art der Kryptografie

  • bzip2 komprimiert
  • Advanced Encryption Standard, auch Rijndael-Algorithmus mit einer Schlüssellänge von 256 werden
GnuPG_OPTS='--compress-algo=bzip2 --personal-cipher-preferences AES256'

Prüfen der GnuPG-Key und GnuPG-Passphrase

De-/Aktivieren der Überprüfung GnuPG-Key und GnuPG-Passphrase
  • duply prüft vor jeder Aktion ob der GnuPG-Key gültig ist und die Passphrase korrekt ist.
  • Dies kann durch die Option GnuPG_TEST='disabled' unterbunden werden.
Aktiviert
GnuPG_TEST='disabled'
Deaktiviert
# GnuPG_TEST='disabled'

Ziel und Quelle des Backups

Allgemeine Syntax des hosts
scheme://[user:password@]host[:port]/[/]path
Protokolle und Syntax zur Datenübertragung
  • duply versteht alle gängigen Protokolle zur Datenübertragung
  • In der conf-Datei befindet sich meistens eine Liste der wichtigsten unterstützten Protokolle und deren Syntax
file://[/absolute_]path
ftp[s]://user[:password]@other.host[:port]/some_dir
hsi://user[:password]@other.host/some_dir
cf+http://container_name
imap[s]://user[:password]@host.com[/from_address_prefix]
rsync://user[:password]@other.host[:port]::/module/some_dir
rsync over ssh (only keyauth)
rsync://user@other.host[:port]/relative_path
rsync://user@other.host[:port]//absolute_path
for the s3 user/password are AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY
s3://[user:password]@host/bucket_name[/prefix]
s3+http://[user:password]@bucket_name[/prefix]
scp and sftp are aliases for the ssh backend
ssh://user</nowiki>[:password]@other.host[:port]/some_dir
tahoe://alias/directory
webdav[s]://user[:password]@other.host/some_dir
Hinweis
Sonderzeichen müssen urlencoded eingetragen werden, außer bei den Parametern TARGET_USER, TARGET_PASS
Ziel des Backups
TARGET='scheme://user[:password]@host[:port]/[/]path'
  • Es soll das Protokoll ssh zur Datenübertragung genutzt werden.
  • Username: user
  • Passwort: KohlIstKrempe969
  • Host: foxtom.net
  • Port: 22
  • Pfad: home/user/backup_PC1
TARGET='ssh://user:KohlIstKrempe969@foxtom.net:22/home/user/backup_PC1'
Quelle des Backups

Root-Verzeichnis für das Backup setzen

SOURCE=

Soll ein Backup aus mehreren Unterordnern von / bestehen (Bsp.: /etc /var /home sollen gesichert werden), so muss die SOURCE Variable auf / gesetzt werden.

SOURCE='/'

In der Regel wird SOURCE='/' gesetzt.

Dateien, die in die Sicherung aufgenommen oder von ihr ausgeschlossen werden, werden in der Datei exclude angegeben.

Maximales Alter eines Backups

Hinweis
duply löscht keine Backups, sofern man es nicht anfordert

Mit MAX_AGE wird das maximale Alter von Backups bestimmt. Das älteste Backup soll maximal ein Jahr alt sein.

MAX_AGE=1Y

Anzahl der vollständigen Backups

Mit MAX_FULL_BACKUPS kann bestimmt werden, wie viele Full-Backups duply maximal behält.

Es sollen fünf sein.

MAX_FULL_BACKUPS=5

Maximales Alter der vollständigen Backups

Alternativ kann mit MAX_FULLBKP_AGE spezifiert werden, wie alt ein Full-Backup sein darf, bevor ein neues Full-Backup erstellt wird.

Es soll zwei Wochen alt sein.

MAX_FULLBKP_AGE=2W
DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE"

Größe der Backup-Pakete

Um den durch eventuelle Übertragungsfehler entstehenden Zeitverlust einzuschränken, teilt duply standardmäßig seine Backups in 25 MB große Dateien. Mit VOLSIZE kann die Größe der erstellten Backup-Pakete geändert werden.

Der gewünschte Wert hängt von verschieden Faktoren ab.

  • Übertragungsgeschwindigkeit
  • Systembelastung
  • Netzwerkbelastung

Vor-/Nachteile

  • Vorteil kleine Pakete
  • Vorteil große Pakete
  • Nachteil kleine Pakete
  • Nachteil große Pakete
Beispiel

Backup-Pakete sollen 10 MB groß sein

VOLSIZE=10
DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE"

Asynchrone Uploads

Asynchrone Uploads erlauben das Erstellen neuer Archive, bevor bereits erstellte auf den Server geladen wurden.

  • Schnelleres Backup
  • Hohe System- und hohe Netzlast

Asynchrone Uploads aktivieren

DUPL_PARAMS="$DUPL_PARAMS --asynchronous-upload"

Dateien

Profile folder
Option Beschreibung
/etc/duply
~/.duply/<profile>
Profile files
Option Beschreibung
conf profile configuration file
pre,post pre/post scripts (see above for details)
gpgkey.*.asc exported GnuPG key files
exclude a globbing list of included or excluded files/folders (see "duplicity manpage", section FILE SELECTION)

Anwendung

Erstmalige Verwendung (Profilerstellung)
 duply <Profil> erstellen
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

Anwendung

GnuPG_KEY='C676563899DE35FA'
GnuPG_PW='NerzManta9'
GnuPG_OPTS='--compress-algo=bzip2 --personal-cipher-preferences AES256'
GnuPG_TEST='disabled'
TARGET='ssh://user:KohlIstKrempe969@foxtom.net:22/home/user/backup_PC1'
SOURCE='/'
MAX_AGE=1Y
MAX_FULL_BACKUPS=5
MAX_FULLBKP_AGE=2W
DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE"
VOLSIZE=10
DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE"

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 pre und post 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 (z. B. bei den Sicherchungs-Methoden "full/incr"), können diese explizit angegeben werden: pre_incr_post
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
/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 exclude im duply Verzeichnis erstellt werden.
  • Die Syntax erlaubt das Hinzufügen von Verzeichnissen und Dateien mit einem + /pfad/zur/datei.
  • Um ein Verzeichnis zu exkludieren muss in der exclude ein - /pfad/zum/Verzeichnis eingefügt werden.
  • Zudem erlaubt duply die Verwendung von Wildcards.
  • Die hier dargestellte exclude Datei sichert die Verzeichnisse /etc/, /root/, /var/www/ und exkludiert alle anderen Verzeichnisse.
+ /etc/
+ /root/
+ /var/www/
- **

Parameter

  • 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 /usr/bin/duply /root/.duply/test full_verify_purge --force wird ein volles Backup erstellt, verifiziert und alte Backups gelöscht.
  • Backups welche die MAX_AGE überschritten haben werden mit purge angezeigt und durch die zusätzliche Option --force gelöscht.
  • Der Befehl /usr/bin/duply /root/.duply/test incr führt ein inkrementelles Backup aus.

cronjob

  • Bei duply handelt es sich nicht um einen Dienst (Daemon), sondern um ein Skript, das z. B. regelmäßig via Cron ausgeführt werden kann.
Beispiel
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

$ duply humbug create

don't forget to edit this new conf file

backup 'humbug' now

$ duply humbug backup

available backup sets

list available backup sets of profile 'humbug'

$ duply humbug status

outdated backups

list and delete outdated backups of 'humbug'
$ duply humbug purge --force

restore

restore latest backup of 'humbug' to /mnt/restore
$ duply humbug restore /mnt/restore
restore /etc/passwd of 'humbug' from 4 days ago to /root/pw
$ duply humbug fetch etc/passwd /root/pw 4D
$ (see "duplicity manpage", section TIME FORMATS)

a one line batch job on 'humbug' for cron execution

$ duply humbug backup_verify_purge --force

batch job to run a full backup with pre/post scripts

$ duply humbug pre_full_post

Fehlerbehebung

Volume was signed by key X not Y

OSError: Socket is closed

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

Syntax

Parameter

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. download txt2man from http://mvertes.free.fr/, put it in the PATH and run 'duply txt2man' to create a man page.
version show version information of duply and needed programs

Umgebungsvariablen

Exit-Status

SEPARATORS

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
'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 etc. Refer to the duplicity manpage for all available formats.

Beispiele
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 (z. B. netrc, .megarc, ssh-Schlüssel) oder Umgebungsvariablen (z. B. DPBX_ACCESS_TOKEN).

Es ist ratsam, diese im Profilordner zu platzieren, wenn dies überhaupt möglich ist. z. B. 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 usw.) 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.


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