Restic - Backuptool vorgestellt
Wie alles anfing ;)
Looking for an efficient, fast and secure open source backup solution? Try @resticbackup!https://t.co/1TQmv2oJfY
— Nico (@tryvann) 7. April 2017
Da ich immer furchtbar neugierig bin, musste ich mir das ansehen. Außerdem war ich schon lange auf der Suche nach einem Backuptool das die Daten verschlüsselt ablegt. Aber, Nico lässt immer die Erklärungen weg, so das ich da dann wieder ran muss ;) Fangen wir an.
Installation:
Restic ist mit der Programmiersprache Go geschrieben worden, so das Restic das Go Paket verlangt. Das muss also installiert werden.
sudo apt-get install golang-go
Unter meinem LinuxMint Cinnamon bekam ich leider eine zu alte Version installiert (1.7). Restic wollte aber eine aktuellere haben (1.8) :( Was machen?
Lösung: https://github.com/golang/go/wiki/Ubuntu
sudo add-apt-repository ppa:longsleep/golang-backportssudo apt-get updatesudo apt-get install golang-gogo versiongo version go1.8 linux/amd64cd tmpgit clone https://github.com/restic/resticcd resticgo run build.gosudo cp restic /usr/binresticrestic versionrestic 0.5.0 (v0.5.0-49-ga725e06)compiled with go1.8 on linux/amd64Repository anlegen!
restic -r /tmp/repo initrestic -r /tmp/repo initenter password for new backend: enter password again: created restic backend 1db770b830 at /tmp/repo Please note that knowledge of your password is required to accessthe repository. Losing your password means that your data isirrecoverably lost.Backup erzeugen!
restic -r /tmp/repo backup /home/frank/Bilderrestic -r /tmp/repo backup /home/frank/Bilderenter password for repository: scan [/home/frank/Bilder]scanned 38 directories, 410 files in 0:00[0:14] 100.00% 101.932 MiB/s 1.412 GiB / 1.412 GiB 448 / 448 items 0 er... ETA 0:00 duration: 0:14, 101.45MiB/ssnapshot 06c3e12b savedrestic -r /tmp/repo snapshotsenter password for repository:ID Date Host Tags Directory----------------------------------------------------------------------06c3e12b 2017-04-07 21:54:03 frank-MS-7850 /home/frank/Bilder644a30bc 2017-04-07 21:55:52 frank-MS-7850 /home/frank/Bilder
------------------------------------
Ein Repo mal mounten
sudo restic -r /tmp/repo mount /mnt/temp[sudo] Passwort für frank:enter password for repository:Now serving the repository at /mnt/tempDon't forget to umount after quitting!
Wichtig: Man muss die entsprechenden Rechte für das Verzeichnis haben, ich hab es hier mal als sudo gemacht.
Das Fenster bleibt aktiv. Also ein anderes öffnen um sich dann im Repo umzusehen.
Und zum Schluß:
umount /mnt/temp
Snapshot restoren
restic -r /tmp/repo restore -t /tmp/restore 644a30bc
Ausgabe:
restic -r /tmp/repo restore -t /tmp/restore 644a30bcenter password for repository:restoring to /tmp/restore
Geschwindigkeitsbeispiele:
Beispiel 1: Ein Backup auf meinem Haupt-PC mit schneller SSD. Bilder-Ordner nach /tmp zum Testen.
restic -r /tmp/repo backup /home/frank/Bilderenter password for repository: scan [/home/frank/Bilder]scanned 38 directories, 410 files in 0:00[0:14] 100.00% 101.932 MiB/s 1.412 GiB / 1.412 GiB 448 / 448 items 0 er... ETA 0:00 duration: 0:14, 101.45MiB/ssnapshot 06c3e12b savedrestic -r /media/privat/Test backup /media/NAS/Dokumenteenter password for repository:scan [/media/NAS/Dokumente]scanned 40777 directories, 229185 files in 2:13[14:17] 100.00% 50.902 MiB/s 42.604 GiB / 42.604 GiB 269962 / 269962 items 0 errors ETA 0:00duration: 14:17, 50.86MiB/ssnapshot c10894df saved/restic -r /media/privat/Test backup /media/NAS/Dokumenteenter password for repository:using parent snapshot c10894dfscan [/media/NAS/Dokumente]scanned 40777 directories, 229185 files in 1:30[2:41] 100.00% 269.293 MiB/s 42.604 GiB / 42.604 GiB 269962 / 269962 items 0 errors ETA 0:01duration: 2:41, 269.77MiB/ssnapshot 6776aa97 savedScripte:
export RESTIC_REPOSITORY =/tmp/repo RESTIC_PASSWORD=foo
#!/bin/bash# Script um meine Dokumente vom NAS regelmäßig zu sichern
# Repo definieren und PW hinterlegenexport RESTIC_REPOSITORY=/media/privat/Restic/Backupexport RESTIC_PASSWORD=12345678
#Was soll gesichert werden?backup_pfad=/media/NAS/Dokumente
#Programm Startrestic -r $RESTIC_REPOSITORY backup $backup_pfad
von Alexander vom 2.2.2016. Den Link und weitere interessante Links findet ihr etwas tiefer.
Update:
Ein Hinweis vom Alexander:
@FrankMankel @tryvann In der Anleitung könntest du minimal was verbessern: restic braucht Go >= 1.7, in Ubuntu gabs anscheinend nur 1.6 https://t.co/xpuN49Nad8
— restic (@resticbackup) 8. April 2017