{"id":1901,"date":"2023-09-09T19:10:45","date_gmt":"2023-09-09T17:10:45","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=1901"},"modified":"2023-12-23T21:11:30","modified_gmt":"2023-12-23T20:11:30","slug":"btrfs-das-dateisystem-unter-linux","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/09\/09\/btrfs-das-dateisystem-unter-linux\/","title":{"rendered":"Btrfs \u2013 das Dateisystem unter Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Btrfs ist eigentlich schon l\u00e4nger bekannt \u2013 es wird auch schon so einige Zeit entwickelt. Grunds\u00e4tzlich k\u00f6nnte man sagen: Btrfs ist das freie ZFS, es hat nicht ganz die Leistung von ZFS, dies ist f\u00fcr normale Benutzer auch nicht relevant. ZFS braucht kein normaler Benutzer am Laptop.<br>ZFS ist vor allem f\u00fcr Hochleistungsrechner gedacht \u2013 etwa f\u00fcr gro\u00dfe Datenbanken.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wir wollen uns hier nicht lange mit den Details befassen \u2013 hier ein grober \u00dcberblick:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Dateigr\u00f6\u00dfe<\/strong> \u2013 maximal 16 Exabyte<\/li>\n\n\n\n<li><strong>Partitionsgr\u00f6\u00dfe<\/strong> \u2013 maximal 16 Exabyte<\/li>\n\n\n\n<li>Kann gut mit vielen kleinen Dateien umgehen<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt wollen wir uns einmal ansehen, was man mit diesem Dateisystem so alles machen kann. Hierzu installiert man unter den meisten Linux-Distributionen (<em>Debian, Void, Ubuntu, &#8230;<\/em>) \u00fcber die Paket-Verwaltung das Paket <strong>btrfs-progs<\/strong>. Sofern nicht anders angegeben, werden alle Befehle am\u00a0Terminal\u00a0mit\u00a0administrativen Rechten\u00a0gestartet.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Dateisystem erweitern<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Nehmen wir einmal an, das Wurzel-Verzeichnis wird zu klein, es ist einfach kein Platz mehr und auch die Festplatte gibt nicht mehr her, ist einfach voll. Wir bauen eine weitere Festplatte ein \u2013 diese nennt sich im Beispiel ganz einfach <strong>\/dev\/sdb<\/strong>, die Partition darauf <strong>1<\/strong> \u2013 also <strong>\/dev\/sdb1<\/strong>. Diese Partition m\u00f6chten wir jetzt zum Wurzel-Verzeichnis hinzuf\u00fcgen \u2013 nein, nicht einf\u00fcgen \u2013, sodass man sie dann unter &#8222;<strong>\/<\/strong>&#8220; mit der Bezeichnung <strong>\/dev\/sdb1<\/strong> findet \u2013 diese wird zu einem Teil von &#8222;<strong>\/<\/strong>&#8220; \u2013 ganz einfach:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs device add \/dev\/sdb1 \/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Syntax lautet also:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs device add neue_partition \/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dasselbe k\u00f6nnte man auch mit dem Home-Verzeichnis machen, ist die Partition zu klein, neue Festplatte rein:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs device add \/dev\/sdb1 \/home<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Eine \u00c4nderung der Datei <strong>\/etc\/fstab<\/strong> ist dabei nicht n\u00f6tig.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wir k\u00f6nnen das angeh\u00e4ngte Dateisystem auch wieder aus dem Verbund l\u00f6schen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs device delete \/dev\/sdb1 \/\nbtrfs device delete \/dev\/sdb1 \/home<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Dateisystem reparieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">L\u00e4uft im Dateisystem einmal etwas schief, reparieren wir dieses etwa von einem Live-System aus  \u2013 denn es darf nicht eingeh\u00e4ngt sein:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs check --repair \/dev\/sda1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Dateisystem defragmentieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Dateisysteme unter Linux fragmentieren kaum, wir sind hier ja nicht unter Windows. Alle paar Jahre zahlt es sich dann aber doch aus. Nehmen wir an, ich will das Verzeichnis <strong>\/home<\/strong> defragmentieren:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs filesystem defragment \/home<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Wir k\u00f6nnen aber auch eine komplette Partition defragmentieren \u2013 etwa <strong>\/dev\/sda1<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs filesystem defragment \/dev\/sda1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Aber auch eine einzelne Datei \u2013 etwa die Datei <strong>dateiname.iso<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs filesystem defragment \/home\/nutzername\/Verzeichnis\/dateiname.iso<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Dateisystem vergr\u00f6\u00dfern und verkleinern<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ist auf der Festplatte noch unbelegter, nicht formatierter Platz, k\u00f6nnen wir ein bestehendes Dateisystem vergr\u00f6\u00dfern. Wollen wir doch gleich einmal das Wurzel-Verzeichnis &#8222;<strong>\/<\/strong>&#8220; um 10 Gigabyte vergr\u00f6\u00dfern (<em>dies kann im laufenden Betrieb geschehen<\/em>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs filesystem resize +10g \/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Oder wir verkleinern dieses um dieselbe Gr\u00f6\u00dfe:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btrfs filesystem resize -10g \/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Snapshots \/ Backups erstellen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Hierzu installiert man sich \u00fcber die Paket-Verwaltung das Paket <strong>snapper<\/strong> \u2013 es erleichtert den Umgang mit Snapshots ungemein.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Zu Beginn erstellen wir uns von der gew\u00fcnschten Partition oder vom gew\u00fcnschten Verzeichnis eine Konfiguration. Im Beispiel m\u00f6chte ich das komplette System sichern:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system create-config \/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Syntax lautet also:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c bezeichnung create-config zu_sicherndes_subvolume<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Konfiguration dazu legt die Software unter <strong>\/etc\/snapper\/configs<\/strong> ab. Jetzt k\u00f6nnen wir die erste Sicherung anlegen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system create --description \"Erste Systemsicherung\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c bezeichnung_der_config create --description \"Bezeichnung der Sicherung\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Jetzt k\u00f6nnen wir uns alle bestehenden Sicherungen anzeigen lassen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system list<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c bezeichnung_der_sicherung list<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"352\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/btrfs-1024x352.jpg\" alt=\"\" class=\"wp-image-1902\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/btrfs-1024x352.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/btrfs-300x103.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/btrfs-768x264.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/btrfs.jpg 1469w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Liegt das Home-Verzeichnis auf der Systempartition \u2013 also direkt im Wurzel-Verzeichnis \u2013, wird es nat\u00fcrlich direkt mitgesichert. Liegt das Home-Verzeichnis auf einer eigenen Partition, kann es nat\u00fcrlich extra gesichert werden \u2013 etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c home create-config \/home<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Automatische Sicherungen sind aktiv<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Haben Sie solche Konfigurationen erstellt, wird auch Cron (<em>der Dienst der unter Linux Aufgaben zu bestimmten Zeiten ausf\u00fchrt<\/em>) aktiv. Sehen wir einmal unter <strong>\/etc\/cron.daily<\/strong> und <strong>\/etc\/cron.hourly<\/strong> nach \u2013 hier liegt je eine Datei namens <strong>snapper<\/strong>. Snapper wird also automatisch einmal st\u00fcndlich und einmal t\u00e4glich eine Sicherung automatisch anlegen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">M\u00f6chten Sie Sicherungen nur manuell erstellen, \u00f6ffnen Sie die erstellten Konfigurationsdateien unter <strong>\/etc\/snapper\/configs<\/strong> als Administrator \u2013 etwa mit dem Shell-Editor Nano \u2013 beispielsweise:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/snapper\/configs\/system<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1024x576.jpg\" alt=\"\" class=\"wp-image-1903\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier finden wir unter anderem folgende Zeile:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TIMELINE_CREATE=\"yes\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Findet sich hier die Option <strong>yes<\/strong>, wird Snapper st\u00fcndlich eine Sicherung anlegen \u2013 m\u00f6chten Sie dies nicht, ersetzen Sie <strong>yes<\/strong> durch <strong>no<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TIMELINE_CLEANUP=\"yes\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Snapper wird nat\u00fcrlich bis zum letzten Ende Sicherungen (<em>Backups<\/em>) anlegen, bis die Platte voll ist (<em>obwohl  \u2013<\/em> <em>Btrfs-Snapshots sind um vieles kleiner als normale Backups<\/em>). Die Zeile oben zeigt \u2013 Snapper wird ab einer gewissen Anzahl von Sicherungen \u00e4ltere l\u00f6schen. M\u00f6chten Sie dies nicht, ersetzen Sie <strong>yes<\/strong> durch <strong>no<\/strong>. Ab wie vielen Snapshots Snapper \u00e4ltere Sicherungen l\u00f6scht, zeigt sich in den Zeilen danach:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># limits for timeline cleanup\nTIMELINE_MIN_AGE=\"1800\"\nTIMELINE_LIMIT_HOURLY=\"10\"\nTIMELINE_LIMIT_DAILY=\"10\"\nTIMELINE_LIMIT_WEEKLY=\"0\"\nTIMELINE_LIMIT_MONTHLY=\"10\"\nTIMELINE_LIMIT_YEARLY=\"10\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die erste Zeile \u2013 <strong>TIMELINE_MIN_AGE=&#8220;1800&#8243;<\/strong> \u2013 zeigt: Zu l\u00f6schende Snapshots m\u00fcssen mindestens\u00a0<strong>1800<\/strong>\u00a0Sekunden alt sein. Anschlie\u00dfend finden Sie in jeder Zeile die Anzahl der gespeicherten Snapshots \u2013 sind mehr Snapshots als hier\u00a0<strong>10<\/strong>\u00a0vorhanden, beginnt Snapper \u00e4ltere zu l\u00f6schen. M\u00f6chten Sie also etwa\u00a0<strong>25<\/strong>\u00a0st\u00fcndliche Sicherungen behalten:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TIMELINE_LIMIT_HOURLY=\"25\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nutzen Sie Cron \u00fcberhaupt nicht, k\u00f6nnen Sie dies auch durch&nbsp;<a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/03\/systemd-die-steuerzentrale-von-linux\/\" data-type=\"post\" data-id=\"783\" target=\"_blank\" rel=\"noreferrer noopener\">Systemd<\/a>&nbsp;erledigen lassen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable snapper-timeline.timer --now\nsystemctl enable snapper-cleanup.timer --now\nsystemctl enable snapper-boot.timer --now<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Erste Zeile aktiviert die Erstellung der Sicherungen, die zweite aktiviert die Bereinigung \u00e4lterer Sicherungen, letzte Zeile erstellt einen Snapshot beim Boot-Vorgang. Jetzt k\u00f6nnen wir uns die erstellten Sicherungskonfigurationen anzeigen lassen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper list-configs<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"379\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1-1024x379.jpg\" alt=\"\" class=\"wp-image-1904\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1-1024x379.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1-300x111.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1-768x284.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-1.jpg 1469w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Sicherungen manuell l\u00f6schen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Wie wir oben schon gesehen haben \u2013 wir k\u00f6nnen uns die einzelnen Sicherungen mit folgendem Befehl anzeigen lassen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c bezeichnung_der_sicherung list<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Vor jeder Sicherung finden Sie eine Ziffer \u2013 etwa die <strong>1<\/strong>. Zum manuellen L\u00f6schen von Sicherungen geben Sie einfach die Ziffer an \u2013 etwa f\u00fcr die <strong>1<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c config delete 1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Statt <strong>config<\/strong> geben Sie nat\u00fcrlich die Konfiguration an. Es lassen sich nat\u00fcrlich auch mehrere Sicherungen gleichzeitig l\u00f6schen \u2013 etwa die <strong>1<\/strong> und die <strong>10<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c config delete 1 10<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Oder die <strong>1<\/strong> bis <strong>10<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c config delete 1-10<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Es dauert ein wenig, bis der Speicherplatz auch tats\u00e4chlich freigegeben wird \u2013 m\u00f6chten Sie den Speicherplatz sofort nutzen, geben Sie zus\u00e4tzlich die Option &#8222;<strong><code>--sync<\/code><\/strong>&#8220; an:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c config delete --sync 1-10<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Unterschiede zwischen Snapshots anzeigen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Bevor wir uns an das Wiederherstellen von Sicherungen machen, sehen wir uns an, wie wir uns die Unterschiede zwischen solchen anzeigen lassen. Lassen wir uns noch einmal alle vorhandenen Sicherungen anzeigen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c config list<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"443\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-2-1024x443.jpg\" alt=\"\" class=\"wp-image-1906\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-2-1024x443.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-2-300x130.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-2-768x333.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-2.jpg 1469w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Im Beispiel haben wir die Sicherungen <strong>1<\/strong> und <strong>2<\/strong>. Wir wollen uns die Unterschiede zwischen diesen anzeigen lassen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system status 1..2<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"443\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-3-1024x443.jpg\" alt=\"\" class=\"wp-image-1907\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-3-1024x443.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-3-300x130.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-3-768x333.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-3.jpg 1469w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Eine zweite M\u00f6glichkeit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system diff 1..2<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"443\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-4-1024x443.jpg\" alt=\"\" class=\"wp-image-1908\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-4-1024x443.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-4-300x130.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-4-768x333.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/snapper-4.jpg 1469w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hiermit werden uns die tats\u00e4chlichen \u00c4nderungen extrem genau angezeigt. Zur besseren \u00dcbersicht l\u00e4sst man sich die Unterschiede in eine Datei ausgeben (<em>diese wird nat\u00fcrlich automatisch erstellt<\/em>), in diesem Beispiel in die Datei <strong>diff.txt<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system diff 1..2 &gt; diff.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nun, jetzt lassen sich Unterschiede in Textdateien sehr genau anzeigen \u2013 im Beispiel m\u00f6chte ich den Unterschied in der Datei <strong>\/etc\/passwd<\/strong> zwischen Snapshot <strong>1<\/strong> und <strong>2<\/strong> anzeigen lassen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system diff 1..2 \/etc\/passwd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Oder die \u00c4nderungen in einem Verzeichnis:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system diff 1..2 \/etc\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Snapshots zur\u00fcckspielen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Auch hier gibt man wieder die zu unterscheidenden Snapshots (also Sicherungen) an. Ich m\u00f6chte wieder den Unterschied zwischen Snapshot <strong>1<\/strong> und <strong>2<\/strong> wiederherstellen, denn zwischen diesen habe ich etwas ge\u00e4ndert und m\u00f6chte es wieder r\u00fcckg\u00e4ngig machen. Im ersten Beispiel m\u00f6chte ich die \u00c4nderungen an der Datei <strong>\/etc\/fstab<\/strong> r\u00fcckg\u00e4ngig machen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system undochange 1..2 \"\/etc\/fstab\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dasselbe mit dem Verzeichnis <strong>\/home\/username\/Dokumente<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system undochange 1..2 \"\/home\/username\/Dokumente\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Geben wir keine Datei oder kein Verzeichnis an, werden alle aufgezeichneten \u00c4nderungen im kompletten System wiederhergestellt:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapper -c system undochange 1..2<\/code><\/pre>\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=\"1901\" 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\">1    <\/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=\"1901\" 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>Btrfs ist eigentlich schon l\u00e4nger bekannt \u2013 es wird auch schon so einige Zeit entwickelt. Grunds\u00e4tzlich k\u00f6nnte man sagen: Btrfs ist das freie ZFS, es hat nicht ganz die Leistung von ZFS, dies ist f\u00fcr normale Benutzer auch nicht relevant. ZFS braucht kein normaler Benutzer am Laptop.ZFS ist vor allem f\u00fcr Hochleistungsrechner gedacht \u2013 etwa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1906,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[15],"class_list":["post-1901","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system","tag-system"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/1901","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=1901"}],"version-history":[{"count":7,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/1901\/revisions"}],"predecessor-version":[{"id":12814,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/1901\/revisions\/12814"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/1906"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=1901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=1901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=1901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}