BorgBackup (Debian): Unterschied zwischen den Versionen

Aus MattWiki
(Die Seite wurde neu angelegt: „ == Installation == Für Debian 8.0 Jessie gibt es im Backports-Repository aktuelle Pakete: # apt-get install borgbackup -t jessie-backports == Kommandozeil…“)
 
K (Matt verschob die Seite Borg Backup (Debian) nach BorgBackup (Debian))
 
(17 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
Quelle: https://borgbackup.readthedocs.io/en/stable/


== Installation ==
== Installation ==
Zeile 5: Zeile 6:
  # apt-get install borgbackup -t jessie-backports
  # apt-get install borgbackup -t jessie-backports


== Kommandozeilenbefehle ==
== Backuprepository initiieren ==
  borg list ARCHIVE-OR-REPOSITORY               # list contents of archive or repository
Zunächst muss ein Repository initiiert werden, z. B. auf der lokalen Maschine:
  borg init --encryption=none|repokey|keyfile /PATH/TO/REPOSITORY/NAME
Initiierung eines Repository auf einer entfernten Maschine:
 
Standardmäßig wird das Repository mit Passwort verschlüsselt <code>--encryption=repokey</code>. Dabei wird das Keyfile im Repository gespeichert und mit einem Passwort gesichert.
 
Alternativ kann die Verschlüsselung deaktiviert werden mit <code>--encryption=none</code> oder es kann mit <code>--encryption=keyfile</code> so verschlüsselt werden, dass das Keyfile lokal in <code>~/.cache/borg/keys/</code> gespeichert wird und mit einem passwort gesichert wird.
 
== Remote-Repositories ==
Können auf zwei Arten angelegt werden: 
sshfs
oder mit Borg auf dem Remote-Repository installiert:
borg init ssh://server.domain.tld:port/PATH/TO/REPOSITORY/NAME
borg init <nowiki>ssh://user@server.domain.tld:port/PATH/TO/REPOSITORY/NAME</nowiki>
 
== Backup erstellen ==
Beim erstellen eines Backups wird ein neues Archiv in einem Repository erstellt. Der Archivname und die zu archivierenden Daten müssen angegeben werden:
borg create -s -v --list /path/to/repo::my-files \
      ~/Documents                                \
      ~/src                                      \
      --exclude '*.pyc'
 
== Informationen über Backupinhalte ==
borg list REPOSITORY                           # List archives in REPOSITORY
borg list REPO::ARCHIVE                        # List contents of ARCHIVE in REPO
borg list ssh://user@server:port/PATHTOREPO    # List contents of remote REPOSITORY via SSH
borg info REPO::ARCHIVE                        # Show details for ARCHIVE such as time and size
borg info ssh://user@server:port/REPO::ARCH    # Show details for ARCHIVE such as time and size                     
                                                # from remote REPOSITORY accessed via SSH
 
== Backup wiederherstellen ==
  borg extract --info REPO::ARCHIVE              # extract ARCHIVE to current directory with debug level info / verbose (-v)  
  borg extract --info REPO::ARCHIVE              # extract ARCHIVE to current directory with debug level info / verbose (-v)  
borg extract --list REPO::ARCHIVE              # extract ARCHIVE to current directory with verbose list
  borg extract --list -n REPO::ARCHIVE          # dry-run ARCHIVE to current directory with verbose list  
  borg extract --list -n REPO::ARCHIVE          # dry-run ARCHIVE to current directory with verbose list  
  borg extract --list --dry-run REPO::ARCHIVE    # dry-run with verbose list  
  borg extract --list --dry-run REPO::ARCHIVE    # dry-run with verbose list  
  borg extract --list REPO::ARCHIVE             # extract ARCHIVE to current directory with verbose list
 
== Archiv mounten ==
Ein Archiv kann ins Dateisystem gemountet werden.
 
Verzeichnis erstellen und gesamtes Repository mounten:
mkdir ~/borgmount
borg mount REPO ~/borgmount
Alternativ kann auch ein einzelnes Archiv gemountet werden:
  borg mount REPO::ARCHIVE
Unmounten:
borg umount ~/borgmount
 
== Key export und import ==
Export auf Papier:
borg key export --paper /path/to/repo /export/to/path
Import von Papier:
borg key import --paper /path/to/repo /import/from/path
 
.
[[Kategorie:Linux]]
[[Kategorie:Linux]]
[[Kategorie:Debian]]
[[Kategorie:Terminal]]
[[Kategorie:Terminal]]

Aktuelle Version vom 29. Oktober 2023, 17:05 Uhr

Quelle: https://borgbackup.readthedocs.io/en/stable/

Installation

Für Debian 8.0 Jessie gibt es im Backports-Repository aktuelle Pakete:

# apt-get install borgbackup -t jessie-backports

Backuprepository initiieren

Zunächst muss ein Repository initiiert werden, z. B. auf der lokalen Maschine:

borg init --encryption=none|repokey|keyfile /PATH/TO/REPOSITORY/NAME

Initiierung eines Repository auf einer entfernten Maschine:

Standardmäßig wird das Repository mit Passwort verschlüsselt --encryption=repokey. Dabei wird das Keyfile im Repository gespeichert und mit einem Passwort gesichert.

Alternativ kann die Verschlüsselung deaktiviert werden mit --encryption=none oder es kann mit --encryption=keyfile so verschlüsselt werden, dass das Keyfile lokal in ~/.cache/borg/keys/ gespeichert wird und mit einem passwort gesichert wird.

Remote-Repositories

Können auf zwei Arten angelegt werden:

sshfs

oder mit Borg auf dem Remote-Repository installiert:

borg init ssh://server.domain.tld:port/PATH/TO/REPOSITORY/NAME
borg init ssh://user@server.domain.tld:port/PATH/TO/REPOSITORY/NAME

Backup erstellen

Beim erstellen eines Backups wird ein neues Archiv in einem Repository erstellt. Der Archivname und die zu archivierenden Daten müssen angegeben werden:

borg create -s -v --list /path/to/repo::my-files \
     ~/Documents                                 \
     ~/src                                       \
     --exclude '*.pyc'

Informationen über Backupinhalte

borg list REPOSITORY                           # List archives in REPOSITORY
borg list REPO::ARCHIVE                        # List contents of ARCHIVE in REPO
borg list ssh://user@server:port/PATHTOREPO    # List contents of remote REPOSITORY via SSH
borg info REPO::ARCHIVE                        # Show details for ARCHIVE such as time and size
borg info ssh://user@server:port/REPO::ARCH    # Show details for ARCHIVE such as time and size                      
                                               # from remote REPOSITORY accessed via SSH

Backup wiederherstellen

borg extract --info REPO::ARCHIVE              # extract ARCHIVE to current directory with debug level info / verbose (-v) 
borg extract --list REPO::ARCHIVE              # extract ARCHIVE to current directory with verbose list
borg extract --list -n REPO::ARCHIVE           # dry-run ARCHIVE to current directory with verbose list 
borg extract --list --dry-run REPO::ARCHIVE    # dry-run with verbose list 

Archiv mounten

Ein Archiv kann ins Dateisystem gemountet werden.

Verzeichnis erstellen und gesamtes Repository mounten:

mkdir ~/borgmount
borg mount REPO ~/borgmount

Alternativ kann auch ein einzelnes Archiv gemountet werden:

borg mount REPO::ARCHIVE

Unmounten:

borg umount ~/borgmount

Key export und import

Export auf Papier:

borg key export --paper /path/to/repo /export/to/path

Import von Papier:

borg key import --paper /path/to/repo /import/from/path

.