{"id":14688,"date":"2024-03-23T21:10:27","date_gmt":"2024-03-23T20:10:27","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=14688"},"modified":"2024-04-07T12:55:45","modified_gmt":"2024-04-07T10:55:45","slug":"restic-terminal-basierte-datensicherungen","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2024\/03\/23\/restic-terminal-basierte-datensicherungen\/","title":{"rendered":"Restic &#8211; Terminal-basierte Datensicherungen"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Restic<\/strong> ist eine Terminal-basierte Datensicherungssoftware, die Backups automatisch mit AES-256 verschl\u00fcsselt und inkrementell und deduplizierend speichert.<br>Alle Daten werden in einem sogenannten Restic-Repository gesichert und k\u00f6nnen sp\u00e4ter anhand einer ID angefordert werden. Diese &#8222;Speicher-ID&#8220; ist der SHA-256-Hash des Inhalts einer Datei.<br>Sicherungen in die Cloud sowie das Wiederherstellen daraus sind ebenfalls m\u00f6glich. Alle Dateien in einem Repository werden nur einmal geschrieben und danach nicht mehr ge\u00e4ndert. Auf diese Weise k\u00f6nnen mehrere Clients gleichzeitig auf das Repository zugreifen und sogar darauf schreiben. Lediglich ein Bereinigungsvorgang entfernt Daten aus dem Repository.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Installation<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Restic<\/em> kann direkt aus den Quellen von Debian und Ubuntu installiert werden:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>sudo apt install restic<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Zum Mounten von Sicherungen\/Snapshots wird FUSE verwendet. Die Nutzung weiterer Clouddienste wie z.B. Owncloud, Webdav erfordert das <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/13\/rclone-verschluesselte-backups-unter-linux-in-die-cloud\/\" data-type=\"link\" data-id=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/13\/rclone-verschluesselte-backups-unter-linux-in-die-cloud\/\">rclone<\/a>-Paket. Beide Pakete installieren Sie im Terminal mit:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>sudo apt install fuse rclone<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Zun\u00e4chst aktualisieren wir <em>Restic<\/em> im Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>sudo restic self-update <\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_1-1.png\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"285\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_1-1.png\" alt=\"\" class=\"wp-image-14694\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_1-1.png 770w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_1-1-150x56.png 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_1-1-300x111.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_1-1-768x284.png 768w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Warten Sie den Vorgang ab.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Verk\u00fcrzte \u00dcbersicht wichtiger  Befehle <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes has-small-font-size\"><table><tbody><tr><td><strong>Unterkommando<\/strong><\/td><td><strong>Auswirkung<\/strong><\/td><\/tr><tr><td>init<\/td><td>Erstellen eines neuen Backup-Speicherplatzes<\/td><\/tr><tr><td>backup<\/td><td>Erstellt ein neues Backup<\/td><\/tr><tr><td>diff<\/td><td>Zeigt die Unterschiede zwischen zwei verschiedenen Backups<\/td><\/tr><tr><td>snapshots<\/td><td>Zeigt alle Snapshots an<\/td><\/tr><tr><td>check<\/td><td>\u00dcberpr\u00fcft den Index eines Backups<\/td><\/tr><tr><td>restore<\/td><td>F\u00fcr das Einspielen eines Backups<\/td><\/tr><tr><td>forget<\/td><td>L\u00f6scht einen Snapshot aus dem Index<\/td><\/tr><tr><td>list<\/td><td>Listet alle Objekte im Repo auf<\/td><\/tr><tr><td>ls<\/td><td>Listet alle Dateien auf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Bedienung<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Die Bedienung von <em>Restic<\/em> erfolgt ausnahmslos \u00fcber die Konsole, mit folgendem Schema:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>restic UNTERKOMMANDO PARAMETER -r PFAD-ZUM-REPO<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bei der Neuerstellung eines Backups wird <em>PFAD-ZUM-REPO<\/em> zum Pfad zu einem leeren Ordner.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Repository erstellen<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Backupordner lokal:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic init -r \/PFAD\/ZUM\/BACKUPORDNER<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Beispiel:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic init -r \/media\/user\/SAFE\/restic_sicherungen<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_2.png\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"175\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_2.png\" alt=\"\" class=\"wp-image-14697\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_2.png 788w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_2-150x33.png 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_2-300x67.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_2-768x171.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Backupordner SFTP:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r sftp:user@host:\/PFAD\/ZUM\/BACKUPORDNER init <\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Backupordner rclone:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r rclone:REMOTE-NAME:\/PFAD\/AUF\/REMOTE\/BACKUPORDNER init <\/strong><\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Backup erstellen<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ein Backup l\u00e4sst sich ganz einfach mit folgenden Befehlen erstellen:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r \/PFAD\/ZUM\/BACKUPORDNER backup \/home \/root<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Um im Beispiel zu bleiben:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r \/media\/user\/SAFE\/restic_sicherungen backup \/home \/root<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nach Eingabe des Passwortes f\u00fcr das vormals erstellte Repository startet der Backup-Prozess.<br>Warten Sie den Vorgang ab.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_3-1.png\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"189\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_3-1.png\" alt=\"\" class=\"wp-image-14700\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_3-1.png 925w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_3-1-150x31.png 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_3-1-300x61.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_3-1-768x157.png 768w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Snapshots \/ Sicherungen anzeigen<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Die vorhandenen Backups bzw. Snapshots werden hiermit aufgelistet:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r \/PFAD\/ZUM\/BACKUPORDNER snapshots<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Im Beispiel:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r \/media\/user\/SAFE\/restic_sicherungen snapshots<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Hier werden die vorhandenen Backups \/ Snapshosts aufgelistet, die angegebene IDs k\u00f6nnen dann z. B. zur Wiederherstellung oder zur \u00dcberpr\u00fcfung verwendet werden.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unser Ausgabebeispiel:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_5.png\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"197\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_5.png\" alt=\"\" class=\"wp-image-14704\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_5.png 857w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_5-150x34.png 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_5-300x69.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/restic_5-768x177.png 768w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Backup einspielen<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mit dem folgenden Befehl wird ein Snapshot mit der ID b3e1e859 nach \/old\/ zur\u00fcckgespielt:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r \/PFAD\/ZUM\/BACKUPORDNER restore ID --target \/old<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Im Beispiel:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>restic -r \/media\/user\/SAFE\/restic_sicherungen restore 8f27e3ab --target \/old<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Mounten eines Backups<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mit dem folgenden Befehl wird ein Backup gemountet wie ein USB-Stick &#8211; jedoch ohne Schreibrechte. Daten k\u00f6nnen nur gelesen oder kopiert, aber nicht ver\u00e4ndert werden.<br>Es ist so m\u00f6glich, sich durch alle vorhandenen Snapshots zu bewegen.<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>mkdir \/mnt\/backup\nrestic -r \/PFAD\/ZUM\/BACKUPORDNER mount \/mnt\/backup <\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Im Beispiel also:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>mkdir \/mnt\/backup\nrestic -r \/media\/user\/SAFE\/restic_sicherungen mount \/mnt\/backup<\/strong><\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Beispiel: Solus<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Neben Debian, Ubuntu und Linux Mint habe ich Restic u. a. auch in Solus getestet. <br>Hier sind folgende Tools erforderlich:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code><strong>sudo eopkg install restic fuse rclone<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ein Update von Restic ist hier nicht n\u00f6tig &#8211; Solus hat die aktuellste Version parat.<br>Fahren Sie mit den weiteren Schritten wie oben beschrieben fort. Im Beispiel hat sich lediglich der Pfad zum Speicherort ge\u00e4ndert&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/solus_restic.png\" rel=\"lightbox-4\"><img loading=\"lazy\" decoding=\"async\" width=\"868\" height=\"590\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/solus_restic.png\" alt=\"\" class=\"wp-image-14723\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/solus_restic.png 868w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/solus_restic-150x102.png 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/solus_restic-300x204.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/03\/solus_restic-768x522.png 768w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>Fazit<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Restic<\/em> ist ein modernes Backup-Programm, das effiziente, sichere und benutzerfreundliche Backup-L\u00f6sungen f\u00fcr verschiedene Betriebssysteme, u. a. Linux und BSD, bietet. Es unterst\u00fctzt verschiedene Speichertypen, erm\u00f6glicht einfache und effektive Backups und ist vollst\u00e4ndig Open Source. <br>Es bietet Funktionen wie Deduplizierung, Verschl\u00fcsselung und die M\u00f6glichkeit, die Integrit\u00e4t der gespeicherten Daten zu \u00fcberpr\u00fcfen. <br>Einmal mit der Befehlssyntax vertraut, sch\u00e4tzt man die Effizienz, Einfachheit und Zuverl\u00e4ssigkeit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Eine umfangreiche Dokumentation (englisch) finden Sie <a href=\"https:\/\/restic.readthedocs.io\/en\/stable\/index.html\" data-type=\"link\" data-id=\"https:\/\/restic.readthedocs.io\/en\/stable\/index.html\">hier<\/a>.<\/p>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"14688\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">12    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"14688\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Restic ist eine Terminal-basierte Datensicherungssoftware, die Backups automatisch mit AES-256 verschl\u00fcsselt und inkrementell und deduplizierend speichert.Alle Daten werden in einem sogenannten Restic-Repository gesichert und k\u00f6nnen sp\u00e4ter anhand einer ID angefordert werden. Diese &#8222;Speicher-ID&#8220; ist der SHA-256-Hash des Inhalts einer Datei.Sicherungen in die Cloud sowie das Wiederherstellen daraus sind ebenfalls m\u00f6glich. Alle Dateien in einem Repository [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":14690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[410,72,17,102],"tags":[802,838,79],"class_list":["post-14688","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-backup","category-sicherheit","category-system","category-tipps-system","tag-datensicherung","tag-restic","tag-sicherung"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/14688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=14688"}],"version-history":[{"count":18,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/14688\/revisions"}],"predecessor-version":[{"id":14753,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/14688\/revisions\/14753"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/14690"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=14688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=14688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=14688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}