Skip to content

Restic - Rootserver als Datenablage nutzen

Restic
2 1 798
  • Wir nehmen hier in diesem Beispiel an, wir nutzen irgendwo im Netz einen Server und wollen unser Homeverzeichnis sichern. Restic funktioniert, der Server ist eingerichtet.

    Mit Restic können wir die Daten beruhigt auf den Server schieben, die Daten werden AES-256 verschlüsselt abgelegt.

    Was brauchen wir?

    • Datei /root/excludes.txt
    • Datei /root/passwd
    • Datei ~/.ssh/config

    /root/excludes.txt

    Die Datei excludes.txt beinhaltet eine Liste der Dateien, die wir nicht sichern wollen.

    .cache
    Bilder
    Downloads
    Musik
    Videos
    

    Je nach Vorlieben kann das dann entsprechend eingestellt werden. Die nächste Datei ist ~/.ssh/config

    ~/.ssh/config

    Host <ip address>
            User <user name>
            Port <port>
    

    Hintergrund für diese Datei. Man kann Restic keinen Port mit übergeben. Wenn man nun, was sinnvoll ist, den Standardport für SSH verlegt habt, dann benötigt man diese Datei damit Restic richtig funktioniert. Das könnt Ihr hier nachlesen.

    /root/passwd

    Hier kommt das Paswort rein, was wir dem Script mit übergeben. So mit taucht das Passwort auch nicht z.B. in htop auf!!

     Passwd12345678
    

    Wir starten mit der Erstellung.

    Restic Init

     root@frank-MS-7A34:~# restic -r sftp:<ip address>:/<user>/backup/home init
     enter password for new repository: 
     enter password again: 
     created restic repository fffffffffffffa at sftp:<ip address>:/<user>/backup/home
     
     Please note that knowledge of your password is required to access
     the repository. Losing your password means that your data is
     irrecoverably lost.
    

    Erledigt. Die Einrichtung ist abgeschlossen.

    Restic Backup

    root@frank-MS-7A34:~# restic --password-file /root/passwd -r sftp:<ip address>:/root/backup/home backup --verbose /home/frank --exclude-file=excludes.txt
    open repository
    repository fffffffffff opened successfully, password is correct
    created new cache in /root/.cache/restic
    lock repository
    load index files
    start scan on [/home/frank]
    start backup on [/home/frank]
    scan finished in 3.888s: 52480 files, 9.811 GiB
    <gekürzt!>
    

    Das oben ist nur der Anfang, danach sichert Restic die ganzen Daten auf dem Rootserver. Das Ganze als kleines Script.

    Script

    #!/bin/bash
    # Script um mit Restic Daten automatisiert zu sichern!
    
    #Was soll gesichert werden?
    backup_pfad=/home/frank
    
    #Programm Start
    restic --password-file /root/passwd -r sftp:<ip address>:/root/backup/home backup --verbose $backup_pfad --exclude-file=excludes.txt
    

    Nix besonderes, aber funktioniert. Das Script dann mittels

    crontab -e
    

    als User root eintragen und fertig!

    Für Anwender, die das nicht als User Root laufen lassen wollen, gibt es hier eine Erklärung wie man es macht. (Ganz unten)

  • Ok, das erste Backup dauert immer was länger 😉 In meinem Fall 5 Std. 16 Minuten.

    Files:       33408 new,     0 changed,     0 unmodified
    Dirs:            1 new,     0 changed,     0 unmodified
    Data Blobs:  20849 new
    Tree Blobs:      2 new
    Added to the repo: 6.278 GiB
    
    processed 33408 files, 8.604 GiB in 5:16:03
    snapshot 5beg1cb3 saved
    

    Aber, das Schöne ist, das die Backups inkrementell angelegt werden. Das nächste geht schneller 🙂

    open repository
    repository 3gg202a2 opened successfully, password is correct
    lock repository
    load index files
    using parent snapshot 5beg1cb3
    start scan on [/home/frank]
    start backup on [/home/frank]
    scan finished in 3.791s: 33788 files, 8.611 GiB
    
    Files:         496 new,    74 changed, 33218 unmodified
    Dirs:            0 new,     1 changed,     0 unmodified
    Data Blobs:    292 new
    Tree Blobs:      2 new
    Added to the repo: 43.661 MiB
    
    processed 33788 files, 8.611 GiB in 2:15
    snapshot fag41bf7 saved
    

    Eine tägliche Sicherung sollte dann wohl reichen.

  • KDE neon Unstable Edition

    Linux kde linux plasma
    6
    2
    0 Stimmen
    6 Beiträge
    429 Aufrufe
    FrankMF
    Heute Morgen beim mal die Testinstallation aktualisiert. 484 Pakete [image: 1700901047287-screenshot_20231125_092126.png] Nach dem Klicken auf Alle aktualisieren, startete der Rechner neu und installierte dann die Updates!? Holy Fuck, das erinnert mich an M$. Aber gut, KDE Neon soll ja auch nicht mein Hauptsystem werden.
  • Nextcloud - extrem lange Ladezeiten

    Nextcloud nextcloud code linux
    1
    1
    0 Stimmen
    1 Beiträge
    184 Aufrufe
    Niemand hat geantwortet
  • Nextcloud 23.0.3

    Nextcloud nextcloud linux
    1
    0 Stimmen
    1 Beiträge
    172 Aufrufe
    Niemand hat geantwortet
  • Fedora 34

    Linux fedora linux
    5
    2
    0 Stimmen
    5 Beiträge
    448 Aufrufe
    FrankMF
    https://www.youtube.com/watch?v=Pzl1B7nB9Kc&t=328s
  • ClusterSSH

    Angeheftet Linux linux
    4
    1
    0 Stimmen
    4 Beiträge
    1k Aufrufe
    FrankMF
    Mal wieder lange dran rumgefummelt, bis es passte. I have figured out how to use any font in xterm. So for the case of the mentioned Inconsolata font size 14, the following works: Add these 2 lines into ~/.Xresources (create it if it does not exist) XTermfaceName: Inconsolata XTermfaceSize: 14 Then, tell xterm to use this file: export XENVIRONMENT="${HOME}/.Xresources" Preferably add this export into .bashrc, so that it is persistent. comment out the font settings in ~/.clusterssh/config, if it exists: # terminal_font=6x13 Quelle: https://unix.stackexchange.com/questions/230106/cluster-ssh-specify-terminal-font
  • Debian 10.4 released und Wireguard kaputt :(

    Linux linux wireguard
    1
    0 Stimmen
    1 Beiträge
    279 Aufrufe
    Niemand hat geantwortet
  • SSH sign_and_send_pubkey: signing failed: agent refused operation

    Linux linux
    1
    1 Stimmen
    1 Beiträge
    269 Aufrufe
    Niemand hat geantwortet
  • FAN control OMV Auyfan 0.10.12: gitlab-ci-linux-build-184, Kernel 5.6

    Linux linux
    12
    1 Stimmen
    12 Beiträge
    1k Aufrufe
    M
    Hi, since I'm currently change my rockpro64 setup I came across this. With the kernel from ayufan you need to set PWM_CTL to /sys/devices/platform/pwm-fan/hwmon/hwmon3/pwm1 for my self compiled one I need /sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1 But I got it only working with one entry for PWM_CTL e.g. PWM_CTL = "/sys/devices/platform/pwm-fan/hwmon/hwmon0/pwm1", after that you need to start ats again sudo systemctl stop ats sudo systemctl start ats initially the fan should start immediately for a short period of time. In case it is even a different one on your kernel you can find the right one using this command. sudo find /sys -name pwm1 | grep hwmon So far I'm not sure which kernel parameter or modul changes this. Martin