tachtler:archlinux_-_minimal_server_installation_-_mit_lvm_und_btrfs_snapper
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
tachtler:archlinux_-_minimal_server_installation_-_mit_lvm_und_btrfs_snapper [2022/07/15 12:07] – [UEFI-Boot: Einen read-write snapshot erzeugen] klaus | tachtler:archlinux_-_minimal_server_installation_-_mit_lvm_und_btrfs_snapper [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== ArchLinux - Minimal Server Installation - mit LVM und Btrfs - snapper====== | ||
- | |||
- | | Mein besonderer Dank gilt hier an dieser Stelle [[http:// | ||
- | | ||
- | [[tachtler: | ||
- | |||
- | [[http:// | ||
- | |||
- | ^ Beschreibung | ||
- | | Homepage | ||
- | | Herunterladen | ||
- | | Dokumentation | ||
- | | Installation | ||
- | | - LVM | [[https:// | ||
- | | - Btrfs | [[https:// | ||
- | |||
- | * //Quelle: [[https:// | ||
- | |||
- | Ab hier werden '' | ||
- | < | ||
- | $ su - | ||
- | Password: | ||
- | </ | ||
- | |||
- | ===== Voraussetzungen ===== | ||
- | |||
- | Für die nachfolgende Installation wird vorausgesetzt, | ||
- | - dass eine lauffähige Version von [[https:// | ||
- | Eine der unter nachfolgenden Links beschriebenen Installationen von [[https:// | ||
- | * [[tachtler: | ||
- | |||
- | ===== Installation: | ||
- | |||
- | Zum erstellen von **Snapshots** ist die Nutzung des Programms [[http:// | ||
- | |||
- | Mit nachfolgendem Befehl, kann [[http:// | ||
- | < | ||
- | [root@archlinux ~]# pacman --noconfirm -S snapper | ||
- | resolving dependencies... | ||
- | looking for conflicting packages... | ||
- | |||
- | Packages (2) boost-libs-1.72.0-4 | ||
- | |||
- | Total Download Size: 3.33 MiB | ||
- | Total Installed Size: 13.81 MiB | ||
- | |||
- | :: Proceed with installation? | ||
- | :: Retrieving packages... | ||
- | | ||
- | | ||
- | (2/2) checking keys in keyring | ||
- | (2/2) checking package integrity | ||
- | (2/2) loading package files | ||
- | (2/2) checking for file conflicts | ||
- | (2/2) checking available disk space [##################### | ||
- | :: Processing package changes... | ||
- | (1/2) installing boost-libs | ||
- | Optional dependencies for boost-libs | ||
- | openmpi: for mpi support | ||
- | (2/2) installing snapper | ||
- | Optional dependencies for snapper | ||
- | pam: pam_snapper [installed] | ||
- | :: Running post-transaction hooks... | ||
- | (1/3) Reloading system manager configuration... | ||
- | (2/3) Arming ConditionNeedsUpdate... | ||
- | (3/3) Reloading system bus configuration... | ||
- | </ | ||
- | |||
- | ===== Konfiguration: | ||
- | |||
- | ==== snapper: root ==== | ||
- | |||
- | Nach der erfolgreichen Installation von [[http:// | ||
- | |||
- | Dazu ist die Anlage einer Konfiguration für das **Btrfs: Subvolume - ''/'' | ||
- | < | ||
- | [root@archlinux ~]# snapper -c root create-config / | ||
- | </ | ||
- | |||
- | Die so neu erstellte Konfigurationsdatei ist in nachfolgendem Verzeichnis mit nachfolgendem Namen '' | ||
- | * ''/ | ||
- | |||
- | Mit der Erstellung der Konfiguration für das **Btrfs: Subvolume - ''/'' | ||
- | * '' | ||
- | erstellt, wie nachfolgender Befehl zeigt: | ||
- | < | ||
- | [root@archlinux ~]# btrfs subvolume list / | ||
- | ID 256 gen 6 top level 5 path @tmp | ||
- | ID 258 gen 7 top level 5 path @home | ||
- | ID 259 gen 8 top level 5 path @var_log | ||
- | ID 260 gen 9 top level 5 path @var_pkg | ||
- | ID 261 gen 33 top level 5 path @root | ||
- | ID 263 gen 20 top level 5 path @srv | ||
- | ID 264 gen 13 top level 5 path @opt | ||
- | ID 265 gen 20 top level 5 path @usr_local | ||
- | ID 266 gen 15 top level 5 path @snapshots | ||
- | ID 269 gen 23 top level 262 path @var/ | ||
- | ID 270 gen 24 top level 262 path @var/ | ||
- | ID 271 gen 33 top level 261 path .snapshots | ||
- | </ | ||
- | |||
- | :!: **HINWEIS** - **Das Btrfs: __Unter__-Subvolume - '' | ||
- | |||
- | **__Erklärung__** | ||
- | |||
- | **Da bei einem möglichen Zurücksetzen auf einen vorherigen Snapshot, dann die Snapshots darin ebenfalls nicht mehr vorhanden wären! - Dafür wurde ein eigenes Btrfs: Subvolume ''/ | ||
- | * **[[tachtler: | ||
- | |||
- | Um das automatisch neu erstellte | ||
- | < | ||
- | [root@archlinux ~]# btrfs subvolume delete / | ||
- | Delete subvolume (no-commit): | ||
- | </ | ||
- | |||
- | Zur Überprüfung, | ||
- | < | ||
- | [root@archlinux ~]# btrfs subvolume list / | ||
- | ID 256 gen 6 top level 5 path @tmp | ||
- | ID 258 gen 7 top level 5 path @home | ||
- | ID 259 gen 8 top level 5 path @var_log | ||
- | ID 260 gen 9 top level 5 path @var_pkg | ||
- | ID 261 gen 34 top level 5 path @root | ||
- | ID 263 gen 20 top level 5 path @srv | ||
- | ID 264 gen 13 top level 5 path @opt | ||
- | ID 265 gen 20 top level 5 path @usr_local | ||
- | ID 266 gen 15 top level 5 path @snapshots | ||
- | ID 269 gen 23 top level 262 path @var/ | ||
- | ID 270 gen 24 top level 262 path @var/ | ||
- | </ | ||
- | |||
- | Anschließend legen wir im Wurzelverzeichnis ein neues Verzeichnis mit dem Namen | ||
- | * **''/ | ||
- | mit nachfolgendem Befehl an: | ||
- | < | ||
- | # [root@archlinux ~]# mkdir /.snapshots | ||
- | </ | ||
- | |||
- | Jetzt muss nur noch die Konfigurationsdatei | ||
- | * ''/ | ||
- | wie folgt erweitert werden, so dass das neue Verzeichnis ''/ | ||
- | < | ||
- | [root@archlinux ~]# vim /etc/fstab | ||
- | </ | ||
- | <code ini> | ||
- | # / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | # / | ||
- | UUID=9c21c98c-57ea-4b0d-9064-4584393cc97f / | ||
- | |||
- | # / | ||
- | UUID=85d0ca9b-def5-4478-9f75-ce20b121a49d / | ||
- | |||
- | # / | ||
- | UUID=3aca2eca-ab55-4655-a844-cac43f8fea6a / | ||
- | |||
- | # / | ||
- | UUID=24b7d52d-ba82-4173-b730-daca60f076e8 / | ||
- | |||
- | # / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | # / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | # / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | # / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | # / | ||
- | UUID=b76e9dd3-ffc3-483d-8e2b-fd397bf7c4a8 none | ||
- | |||
- | # / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | </ | ||
- | ** *//Der __letzte__ Eintrag ist hinzugekommen!// | ||
- | |||
- | **__Erklärung__** | ||
- | |||
- | * <code ini># / | ||
- | UUID=1c250bce-9e86-4d82-b921-3eca687f8403 / | ||
- | |||
- | Hinzufügen eines **Mount**-Points (Einhängepunktes im Dateisystem) für das **Btrfs: Subvolume** - '' | ||
- | |||
- | Um den in der Konfigurationsdatei ''/ | ||
- | < | ||
- | [root@archlinux ~]# mount / | ||
- | </ | ||
- | |||
- | Ob das **mount**en von Hand erfolgreich war, kann mit nachfolgendem Befehl überprüft werden: | ||
- | < | ||
- | [root@archlinux ~]# mount | grep /dev/mapper | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | </ | ||
- | |||
- | Um sicher zu gehen, das [[http:// | ||
- | < | ||
- | [root@archlinux ~]# snapper list | ||
- | # | Type | Pre # | Date | User | Cleanup | Description | Userdata | ||
- | ---+--------+-------+------+------+---------+-------------+--------- | ||
- | 0 | single | | ||
- | </ | ||
- | |||
- | ==== / | ||
- | |||
- | Nachfolgende Einstellungen passen das Verhalten von [[http:// | ||
- | - Es sollen **__KEINE__ stündlichen Snapshots** durchgeführt werden. | ||
- | - Die **Anzahl von aufzubewahrenden Snapshots** soll begrenzt werden. | ||
- | - Die **Anzahl der als __wichtig__ gekennzeichneten Snapshots** soll begrenzt werden. | ||
- | < | ||
- | [root@archlinux ~]# vim / | ||
- | </ | ||
- | |||
- | <code ini> | ||
- | |||
- | # subvolume to snapshot | ||
- | SUBVOLUME="/" | ||
- | |||
- | # filesystem type | ||
- | FSTYPE=" | ||
- | |||
- | |||
- | # btrfs qgroup for space aware cleanup algorithms | ||
- | QGROUP="" | ||
- | |||
- | |||
- | # fraction of the filesystems space the snapshots may use | ||
- | SPACE_LIMIT=" | ||
- | |||
- | # fraction of the filesystems space that should be free | ||
- | FREE_LIMIT=" | ||
- | |||
- | |||
- | # users and groups allowed to work with config | ||
- | ALLOW_USERS="" | ||
- | ALLOW_GROUPS="" | ||
- | |||
- | # sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots | ||
- | # directory | ||
- | SYNC_ACL=" | ||
- | |||
- | |||
- | # start comparing pre- and post-snapshot in background after creating | ||
- | # post-snapshot | ||
- | BACKGROUND_COMPARISON=" | ||
- | |||
- | |||
- | # run daily number cleanup | ||
- | NUMBER_CLEANUP=" | ||
- | |||
- | # limit for number cleanup | ||
- | # Tachtler | ||
- | # default: NUMBER_MIN_AGE=" | ||
- | NUMBER_MIN_AGE=" | ||
- | # Tachtler | ||
- | # default: NUMBER_LIMIT=" | ||
- | NUMBER_LIMIT=" | ||
- | # Tachtler | ||
- | # default: NUMBER_LIMIT_IMPORTANT=" | ||
- | NUMBER_LIMIT_IMPORTANT=" | ||
- | |||
- | |||
- | # create hourly snapshots | ||
- | # Tachtler | ||
- | # default: TIMELINE_CREATE=" | ||
- | TIMELINE_CREATE=" | ||
- | |||
- | # cleanup hourly snapshots after some time | ||
- | TIMELINE_CLEANUP=" | ||
- | |||
- | # limits for timeline cleanup | ||
- | TIMELINE_MIN_AGE=" | ||
- | TIMELINE_LIMIT_HOURLY=" | ||
- | TIMELINE_LIMIT_DAILY=" | ||
- | TIMELINE_LIMIT_WEEKLY=" | ||
- | TIMELINE_LIMIT_MONTHLY=" | ||
- | TIMELINE_LIMIT_YEARLY=" | ||
- | |||
- | |||
- | # cleanup empty pre-post-pairs | ||
- | EMPTY_PRE_POST_CLEANUP=" | ||
- | |||
- | # limits for empty pre-post-pair cleanup | ||
- | EMPTY_PRE_POST_MIN_AGE=" | ||
- | </ | ||
- | |||
- | **__Erklärungen__**: | ||
- | |||
- | * <code ini># run daily number cleanup | ||
- | NUMBER_CLEANUP=" | ||
- | |||
- | Falls nicht bereits auf **" | ||
- | |||
- | * <code ini># limit for number cleanup | ||
- | # Tachtler | ||
- | # default: NUMBER_MIN_AGE=" | ||
- | NUMBER_MIN_AGE=" | ||
- | |||
- | Bewrikt, das das Alter eines **Snapshats** ignoriert und nur die Anzahl entscheinden ist, da sonst ggf. unbeabsichtigt automatisch evtl. ein **Snapshot** gelöscht wird. | ||
- | |||
- | * <code ini># Tachtler | ||
- | # default: NUMBER_LIMIT=" | ||
- | NUMBER_LIMIT=" | ||
- | |||
- | Anzahl der zu speichernden **Snapshots**. | ||
- | |||
- | * <code ini># Tachtler | ||
- | # default: NUMBER_LIMIT_IMPORTANT=" | ||
- | NUMBER_LIMIT_IMPORTANT=" | ||
- | |||
- | Anzahl der zu speichernden - **__wichtigen__** - **Snapshots**. | ||
- | |||
- | * <code ini># create hourly snapshots | ||
- | # Tachtler | ||
- | # default: TIMELINE_CREATE=" | ||
- | TIMELINE_CREATE=" | ||
- | |||
- | Verhindert, das **__jede Stunde__** automatisch ein **Snapshot** erstellt wird. | ||
- | |||
- | ==== / | ||
- | |||
- | Damit jedoch **stündlich** durch den **systemd - timer** ältere, anhand der Anzahl der vorhandenen **Snapshots** automatishc auch gelöscht werden können, muss mit nachfolgendem Befehl der mit der Installation mit gekommene Timer | ||
- | * ''/ | ||
- | aktiviert werden: | ||
- | < | ||
- | [root@archlinux /]# systemctl enable --now snapper-cleanup.timer | ||
- | Created symlink / | ||
- | </ | ||
- | * //Die Angabe des Parameters '' | ||
- | |||
- | Ob dies korrekt funktioniert hat, kann mit nachfolgendem Befehl überprüft werden: | ||
- | < | ||
- | [root@archlinux /]# systemctl list-timers | ||
- | NEXT LEFT | ||
- | Tue 2020-12-08 00:00:00 CET 6h left n/a | ||
- | Tue 2020-12-08 17:10:19 CET 23h left Mon 2020-12-07 17:10:19 CET 5min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service | ||
- | Tue 2020-12-08 17:15:22 CET 23h left Mon 2020-12-07 17:15:22 CET 30s ago snapper-cleanup.timer | ||
- | |||
- | 3 timers listed. | ||
- | Pass --all to see loaded but inactive timers, too. | ||
- | </ | ||
- | |||
- | ===== Installation: | ||
- | |||
- | Damit aus dem mit [[http:// | ||
- | * [[https:// | ||
- | erforderlich. | ||
- | |||
- | Mit nachfolgendem Befehl, kann [[http:// | ||
- | < | ||
- | [root@archlinux ~]# pacman --noconfirm -S grub-btrfs | ||
- | resolving dependencies... | ||
- | looking for conflicting packages... | ||
- | |||
- | Packages (1) grub-btrfs-4.7.1-1 | ||
- | |||
- | Total Download Size: 0.02 MiB | ||
- | Total Installed Size: 0.06 MiB | ||
- | |||
- | :: Proceed with installation? | ||
- | :: Retrieving packages... | ||
- | | ||
- | (1/1) checking keys in keyring | ||
- | (1/1) checking package integrity | ||
- | (1/1) loading package files | ||
- | (1/1) checking for file conflicts | ||
- | (1/1) checking available disk space [################# | ||
- | :: Processing package changes... | ||
- | (1/1) installing grub-btrfs | ||
- | Optional dependencies for grub-btrfs | ||
- | snapper: Snapper support [installed] | ||
- | :: Running post-transaction hooks... | ||
- | (1/3) Reloading system manager configuration... | ||
- | (2/3) Arming ConditionNeedsUpdate... | ||
- | (3/3) Updating linux initcpios... | ||
- | ==> Building image from preset: / | ||
- | -> -k / | ||
- | ==> Starting build: 5.4.81-1-lts | ||
- | -> Running build hook: [base] | ||
- | -> Running build hook: [udev] | ||
- | -> Running build hook: [autodetect] | ||
- | -> Running build hook: [modconf] | ||
- | -> Running build hook: [block] | ||
- | -> Running build hook: [lvm2] | ||
- | -> Running build hook: [btrfs] | ||
- | -> Running build hook: [filesystems] | ||
- | -> Running build hook: [keymap] | ||
- | -> Running build hook: [keyboard] | ||
- | ==> Generating module dependencies | ||
- | ==> Creating gzip-compressed initcpio image: / | ||
- | ==> Image generation successful | ||
- | ==> Building image from preset: / | ||
- | -> -k / | ||
- | ==> Starting build: 5.4.81-1-lts | ||
- | -> Running build hook: [base] | ||
- | -> Running build hook: [udev] | ||
- | -> Running build hook: [modconf] | ||
- | -> Running build hook: [block] | ||
- | ==> WARNING: Possibly missing firmware for module: aic94xx | ||
- | ==> WARNING: Possibly missing firmware for module: wd719x | ||
- | -> Running build hook: [lvm2] | ||
- | -> Running build hook: [btrfs] | ||
- | -> Running build hook: [filesystems] | ||
- | -> Running build hook: [keymap] | ||
- | -> Running build hook: [keyboard] | ||
- | ==> Generating module dependencies | ||
- | ==> Creating gzip-compressed initcpio image: / | ||
- | ==> Image generation successful | ||
- | </ | ||
- | |||
- | Die Konfiguration für das Programm [[https:// | ||
- | * ''/ | ||
- | |||
- | :!: **HINWEIS** - **Anpassungen müssen hier __keine__ erfolgen!** | ||
- | |||
- | ===== Installation: | ||
- | |||
- | Hierbei handelt es sich um eine Reihe von '' | ||
- | |||
- | Dies bietet eine einfache Möglichkeit, | ||
- | |||
- | Mit nachfolgendem Befehl, kann [[https:// | ||
- | < | ||
- | [root@archlinux ~]# pacman --noconfirm -S snap-pac | ||
- | resolving dependencies... | ||
- | looking for conflicting packages... | ||
- | |||
- | Packages (1) snap-pac-2.3.1-2 | ||
- | |||
- | Total Download Size: 0.02 MiB | ||
- | Total Installed Size: 0.03 MiB | ||
- | |||
- | :: Proceed with installation? | ||
- | :: Retrieving packages... | ||
- | | ||
- | (1/1) checking keys in keyring | ||
- | (1/1) checking package integrity | ||
- | (1/1) loading package files | ||
- | (1/1) checking for file conflicts | ||
- | (1/1) checking available disk space [################# | ||
- | :: Processing package changes... | ||
- | (1/1) installing snap-pac | ||
- | :: Running post-transaction hooks... | ||
- | (1/3) Arming ConditionNeedsUpdate... | ||
- | (2/3) Performing snapper post snapshots for the following configurations... | ||
- | (3/3) You are installing snap-pac, so no post transaction snapshots will be taken. | ||
- | </ | ||
- | |||
- | ===== Konfiguration: | ||
- | |||
- | Nachfolgender **'' | ||
- | * ''/ | ||
- | auf Änderungen und erstellt daraufhin die Konfigurationsdaten für den **" | ||
- | |||
- | :!: **HINWEIS** - **Falls ein anderes Verzeichnis als ''/ | ||
- | * ''/ | ||
- | |||
- | :!: **HINWEIS** - Eine Vorlage für den Inhalt, hält die Konfigurationsdatei ''/ | ||
- | |||
- | :!: **ACHTUNG** - **Hier ist aktuelle keine Anpassung an der Konfigurationsdatei '''' | ||
- | |||
- | ==== grub-btrfs.path.service-Dienst/ | ||
- | |||
- | Um den **grub-btrfs.path.service**-Dienst/ | ||
- | < | ||
- | [root@archlinux ~]# systemctl enable grub-btrfs.path | ||
- | Created symlink / | ||
- | </ | ||
- | |||
- | Eine Überprüfung, | ||
- | < | ||
- | [root@archlinux ~]# systemctl list-unit-files --type=service | grep grub-btrfs | ||
- | grub-btrfs.service | ||
- | </ | ||
- | bzw. | ||
- | < | ||
- | [root@archlinux ~]# systemctl is-enabled grub-btrfs | ||
- | static | ||
- | </ | ||
- | |||
- | Abschließend kann der **SSH**-Dienst/ | ||
- | < | ||
- | [root@archlinux ~]# systemctl start --now grub-btrfs.path | ||
- | </ | ||
- | |||
- | Eine Überprüfung ob der **grub-btrfs.path.service**-Dienst/ | ||
- | < | ||
- | [root@archlinux ~]# systemctl status grub-btrfs.path | ||
- | ● grub-btrfs.path - Monitors for new snapshots | ||
- | | ||
- | | ||
- | | ||
- | |||
- | Dec 07 17:36:55 vml010 systemd[1]: Started Monitors for new snapshots. | ||
- | </ | ||
- | |||
- | ===== Praxis ===== | ||
- | |||
- | ==== Auf einen snapshot zurücksetzen ==== | ||
- | |||
- | Nachfolgender soll das Programm '' | ||
- | |||
- | Mit nachfolgendem Befehl, kann '' | ||
- | < | ||
- | [root@archlinux ~]# pacman --noconfirm -S screenfetch | ||
- | resolving dependencies... | ||
- | looking for conflicting packages... | ||
- | |||
- | Packages (18) bc-1.07.1-4 | ||
- | libxcomposite-0.4.5-3 | ||
- | libxfixes-5.0.3-4 | ||
- | libxrender-0.9.10-4 | ||
- | xcb-proto-1.14.1-3 | ||
- | xorg-xprop-1.2.5-1 | ||
- | |||
- | Total Download Size: 3.95 MiB | ||
- | Total Installed Size: 17.84 MiB | ||
- | |||
- | :: Proceed with installation? | ||
- | :: Retrieving packages... | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | (18/18) checking keys in keyring | ||
- | (18/18) checking package integrity | ||
- | (18/18) loading package files | ||
- | (18/18) checking for file conflicts | ||
- | (18/18) checking available disk space [################# | ||
- | :: Running pre-transaction hooks... | ||
- | (1/1) Performing snapper pre snapshots for the following configurations... | ||
- | ==> root: 1 | ||
- | :: Processing package changes... | ||
- | ( 1/18) installing bc [################# | ||
- | ( 2/18) installing xcb-proto | ||
- | ( 3/18) installing libxdmcp | ||
- | ( 4/18) installing libxau | ||
- | ( 5/18) installing libxcb | ||
- | ( 6/18) installing xorgproto | ||
- | ( 7/18) installing libx11 | ||
- | ( 8/18) installing libxext | ||
- | ( 9/18) installing libxi | ||
- | (10/18) installing libxfixes | ||
- | (11/18) installing libxtst | ||
- | (12/18) installing libxxf86vm | ||
- | (13/18) installing libxrender | ||
- | (14/18) installing libxcomposite | ||
- | (15/18) installing libxinerama | ||
- | (16/18) installing xorg-xdpyinfo | ||
- | (17/18) installing xorg-xprop | ||
- | (18/18) installing screenfetch | ||
- | Optional dependencies for screenfetch | ||
- | scrot: to take screenshot | ||
- | :: Running post-transaction hooks... | ||
- | (1/3) Arming ConditionNeedsUpdate... | ||
- | (2/3) Updating the info directory file... | ||
- | (3/3) Performing snapper post snapshots for the following configurations... | ||
- | ==> root: 2 | ||
- | </ | ||
- | |||
- | Anhand der Ausgabe bei der Installation, | ||
- | - Snapshot: '' | ||
- | - Snapshot: '' | ||
- | |||
- | Dies kann auch durch Abfrage mit nachfolgendem Befehl bestätigt werden: | ||
- | < | ||
- | [root@archlinux ~]# snapper list | ||
- | # | Type | Pre # | Date | User | Cleanup | Description | ||
- | ---+--------+-------+---------------------------------+------+---------+-----------------------------------------------------------------------------+--------- | ||
- | 0 | single | | ||
- | 1 | pre | | Mon 07 Dec 2020 05:39:43 PM CET | root | number | ||
- | 2 | post | ||
- | </ | ||
- | |||
- | Eine Überprüfung, | ||
- | < | ||
- | root@archlinux ~]# screenfetch | ||
- | | ||
- | .o+` | ||
- | | ||
- | `+oooo: | ||
- | | ||
- | | ||
- | | ||
- | `/ | ||
- | | ||
- | `/ | ||
- | | ||
- | .oossssso-````/ | ||
- | | ||
- | : | ||
- | / | ||
- | | ||
- | `+sso+: | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | Um jetzt die Installation von '' | ||
- | < | ||
- | [root@archlinux ~]# snapper -v undochange 1..2 | ||
- | create:0 modify:2 delete:4235 | ||
- | ... | ||
- | </ | ||
- | |||
- | Ein erneuter Aufruf von '' | ||
- | < | ||
- | [root@archlinux ~]# screenfetch | ||
- | -bash: / | ||
- | </ | ||
- | |||
- | ==== In einen snapshot starten (booten) ==== | ||
- | |||
- | Alle möglichen **Snapshots** in die gestartet werden kann, sind in einem **Untermenü** beim Neustart in [[https:// | ||
- | |||
- | {{: | ||
- | |||
- | Druch Auswahl des [[https:// | ||
- | |||
- | {{: | ||
- | |||
- | Durch Auswahl des obersten Menüpunktes, | ||
- | |||
- | {{: | ||
- | |||
- | Nach einem erfolgreichen Startvorgang (booten), kann das Programm '' | ||
- | < | ||
- | [root@archlinux ~]# screenfetch | ||
- | | ||
- | .o+` | ||
- | | ||
- | `+oooo: | ||
- | | ||
- | | ||
- | | ||
- | `/ | ||
- | | ||
- | `/ | ||
- | | ||
- | .oossssso-````/ | ||
- | | ||
- | : | ||
- | / | ||
- | | ||
- | `+sso+: | ||
- | | ||
- | | ||
- | [root@archlinux ~]# | ||
- | </ | ||
- | |||
- | :!: **ACHTUNG** - **Der gestartet Snapshot ist ein " | ||
- | |||
- | Der Versuch in das **Btrfs: Subvolume - ''/'' | ||
- | < | ||
- | [root@archlinux ~]# touch /test.txt | ||
- | touch: cannot touch '/ | ||
- | </ | ||
- | |||
- | Damit wieder eine **__read-write__** **Snapshot** aus dem aktuell gestarteten **Snapshot** wird, sind nachfolgende Schritte erforderlich. | ||
- | |||
- | ===== Praxis: BIOS-Boot ===== | ||
- | |||
- | |||
- | ==== BIOS-Boot: Einen read-write snapshot erzeugen ==== | ||
- | |||
- | Mit nachfolgenden Befehlen und einem **Neustart** wird aus einem **__read-only__** **Snapshot** wieder ein **__read-write__** **Snapshot**. | ||
- | |||
- | Nachfolgender Befehl überprüft, | ||
- | < | ||
- | [root@archlinux ~]# mount | grep / | ||
- | / | ||
- | </ | ||
- | |||
- | Um jetzt mit einen **Rollback** (zurücksetzen) auch auf einen **beliebigen** startbaren (boot) **Snapshot** gehen zu können, ist es erforderlich aus dem **__read-only__** **Snapshot** wieder einen **__read-write__** **Snapshot** zu erstellen, was mit nachfolgendem Befehl durchgeführt werden kann: | ||
- | < | ||
- | [root@archlinux ~]# snapper -a classic rollback 2 | ||
- | Ambit is classic. | ||
- | Creating read-only snapshot of current system. (Snapshot 3.) | ||
- | Creating read-write snapshot of snapshot 2. (Snapshot 4.) | ||
- | Setting default subvolume to snapshot 4. | ||
- | </ | ||
- | |||
- | Wichtig ist hier der **Snapshot** mit der Nummer **'' | ||
- | |||
- | :!: **WICHTIG** - **Leider kann nur über das editieren beim Starten via [[https:// | ||
- | |||
- | Nachfolgend ist wieder ein Neustart durchzuführen: | ||
- | |||
- | < | ||
- | [root@archlinux ~]# systemctl reboot | ||
- | </ | ||
- | |||
- | {{: | ||
- | |||
- | Durch Auswahl des [[https:// | ||
- | |||
- | {{: | ||
- | |||
- | Durch Auswahl des obersten Menüpunktes, | ||
- | |||
- | {{: | ||
- | |||
- | :!: **WICHTIG** - **Jetzt ist die [e]-Taste zu drücken um den [[https:// | ||
- | |||
- | {{: | ||
- | |||
- | :!: **WICHTIG** - **Ersetzen der Snapshot-Nummer '' | ||
- | |||
- | :!: **WICHTIG** - **Um die Änderungen wirksam werden zu lassen, ist die [F10]-Taste oder [Ctrl-x]|[Strg-x] zu betätigen !!!** | ||
- | |||
- | Jetzt kann mit nachfolgendem Befehl überprüft werden, ob der **Snapshot** mit der Nummer **'' | ||
- | < | ||
- | [root@archlinux ~]# mount | grep / | ||
- | / | ||
- | </ | ||
- | |||
- | Und ob dieser auch ein **__read-write__** **Snapshot** ist, wie nachfolgender Befehl beweist: | ||
- | < | ||
- | [root@archlinux ~]# touch /test.txt | ||
- | </ | ||
- | < | ||
- | [root@archlinux ~]# ls -la /test.txt | ||
- | -rw-r--r-- 1 root root 0 Dec 7 18:14 /test.txt | ||
- | </ | ||
- | |||
- | :!: **WICHTIG** - **Damit zukünftig von diesem Snapshot - __standardmässig__ gestartet wird, muss nachfolgender Befehl ausgeführt werden:** | ||
- | |||
- | Hier wird der **Bootloader** - hier [[https:// | ||
- | < | ||
- | [root@archlinux ~]# grub-install /dev/vda | ||
- | Installing for i386-pc platform. | ||
- | Installation finished. No error reported. | ||
- | </ | ||
- | |||
- | Anschließend muss noch der **Bootloader** - hier [[https:// | ||
- | < | ||
- | [root@archlinux ~]# grub-mkconfig -o / | ||
- | Generating grub configuration file ... | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found fallback initrd image(s) in /boot: initramfs-linux-lts-fallback.img | ||
- | Detecting snapshots ... | ||
- | Info: Separate boot partition not detected | ||
- | Info: snapper detected, using config ' | ||
- | Found snapshot: 2020-12-07 18:00:31 | @snapshots/ | ||
- | Found snapshot: 2020-12-07 18:00:31 | @snapshots/ | ||
- | Found snapshot: 2020-12-07 17:39:44 | @snapshots/ | ||
- | Found snapshot: 2020-12-07 17:39:43 | @snapshots/ | ||
- | Found 4 snapshot(s) | ||
- | done | ||
- | </ | ||
- | |||
- | < | ||
- | [root@archlinux ~]# systemctl reboot | ||
- | </ | ||
- | |||
- | Nach einem **erneuten Neustart** sollte jetzt der **Snapshot** mit der Nummer **'' | ||
- | |||
- | {{: | ||
- | |||
- | Eine Überprüfung, | ||
- | < | ||
- | [root@archlinux ~]# mount | grep / | ||
- | / | ||
- | </ | ||
- | |||
- | |||
- | ===== Praxis: UEFI-Boot ===== | ||
- | |||
- | ==== UEFI-Boot: 05-bootbackup.hook ==== | ||
- | |||
- | Nachdem es bei der Verwendung von UEFI-Boot eine separate BOOT-Partition meist mit dem Dateisystem '' | ||
- | |||
- | Dazu soll in nachfolgendem Verzeichnis, | ||
- | |||
- | Dadurch wird eine Sicherung des Inhalts des Verzeichnisses ''/ | ||
- | |||
- | :!: **WICHTIG** - **Sonst passen z.B.** | ||
- | * **'' | ||
- | * **'' | ||
- | * **'' | ||
- | **nicht zum '' | ||
- | |||
- | Nachfolgender Befehl erstellt die Konfigurationsdatei für den **'' | ||
- | < | ||
- | # vim / | ||
- | </ | ||
- | |||
- | <code ini> | ||
- | [Trigger] | ||
- | Operation = Upgrade | ||
- | Operation = Install | ||
- | Operation = Remove | ||
- | Type = Path | ||
- | Target = usr/ | ||
- | |||
- | [Action] | ||
- | Depends = rsync | ||
- | Description = Backing up /boot... | ||
- | When = PreTransaction | ||
- | Exec = / | ||
- | </ | ||
- | |||
- | ==== UEFI-Boot: Einen read-write snapshot erzeugen ==== | ||
- | |||
- | Mit nachfolgenden Befehlen und einem **Neustart** wird aus einem **__read-only__** **Snapshot** wieder ein **__read-write__** **Snapshot**. | ||
- | |||
- | Nachfolgender Befehl überprüft, | ||
- | < | ||
- | [root@archlinux ~]# mount | grep /.snapshots | ||
- | / | ||
- | </ | ||
- | |||
- | Um jetzt mit einen **Rollback** (zurücksetzen) auch auf einen **beliebigen** startbaren (boot) **Snapshot** gehen zu können, ist es erforderlich aus dem **__read-only__** **Snapshot** wieder einen **__read-write__** **Snapshot** zu erstellen, was mit nachfolgendem Befehl durchgeführt werden kann: | ||
- | < | ||
- | [root@archlinux ~]# snapper -a classic rollback 2 | ||
- | Ambit is classic. | ||
- | Creating read-only snapshot of current system. (Snapshot 3.) | ||
- | Creating read-write snapshot of snapshot 2. (Snapshot 4.) | ||
- | Setting default subvolume to snapshot 4. | ||
- | </ | ||
- | |||
- | Wichtig ist hier der **Snapshot** mit der Nummer **'' | ||
- | |||
- | :!: **WICHTIG** - **Leider kann nur über das editieren beim Starten via [[https:// | ||
- | |||
- | Nachfolgend ist wieder ein Neustart durchzuführen: | ||
- | |||
- | < | ||
- | [root@archlinux ~]# systemctl reboot | ||
- | </ | ||
- | |||
- | {{: | ||
- | |||
- | Durch Auswahl des [[https:// | ||
- | |||
- | {{: | ||
- | |||
- | Durch Auswahl des obersten Menüpunktes, | ||
- | |||
- | {{: | ||
- | |||
- | :!: **WICHTIG** - **Jetzt ist die [e]-Taste zu drücken um den [[https:// | ||
- | |||
- | {{: | ||
- | |||
- | :!: **WICHTIG** - **Ersetzen der Snapshot-Nummer '' | ||
- | |||
- | :!: **WICHTIG** - **Um die Änderungen wirksam werden zu lassen, ist die [F10]-Taste oder [Ctrl-x]|[Strg-x] zu betätigen !!!** | ||
- | |||
- | Jetzt kann mit nachfolgendem Befehl überprüft werden, ob der **Snapshot** mit der Nummer **'' | ||
- | < | ||
- | mount | grep /.snapshots | ||
- | / | ||
- | </ | ||
- | |||
- | Und ob dieser auch ein **__read-write__** **Snapshot** ist, wie nachfolgender Befehl beweist: | ||
- | < | ||
- | [root@archlinux ~]# touch /test.txt | ||
- | </ | ||
- | < | ||
- | [root@archlinux ~]# ls -la /test.txt | ||
- | -rw-r--r-- 1 root root 0 Dec 7 18:14 /test.txt | ||
- | </ | ||
- | |||
- | :!: **WICHTIG** - **Falls Fehler beim starten (booten) auftreten, werden diese durch tauschen der gesicherten ''/ | ||
- | |||
- | Nachfolgender Befehl **kopiert** die aus dem " | ||
- | < | ||
- | # cp -ar / | ||
- | </ | ||
- | |||
- | Abschließend muss nun noch einmal das BOOT-Menü neu erzeugt werden, um keine Menü-Einträge zu verlieren: | ||
- | < | ||
- | [root@archlinux ~]# grub-mkconfig -o / | ||
- | Generating grub configuration file ... | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found fallback initrd image(s) in /boot: initramfs-linux-lts-fallback.img | ||
- | Detecting snapshots ... | ||
- | Info: Separate boot partition not detected | ||
- | Info: snapper detected, using config ' | ||
- | Found snapshot: 2020-12-07 18:25:56 | @root | ||
- | Found 1 snapshot(s) | ||
- | done | ||
- | </ | ||
- | |||
- | Abschlißend ist wieder ein Neustart durchzuführen: | ||
- | < | ||
- | [root@archlinux ~]# systemctl reboot | ||
- | </ | ||
- | |||
- | ===== Praxis: BIOS & UEFI-Boot ===== | ||
- | |||
- | ==== Einen snapshot zu root zurücksetzen ==== | ||
- | |||
- | Nachdem in einen **__read-write__** **Snapshot** gestartet (boot) wurde, soll dieser wieder zum **'' | ||
- | |||
- | Dazu soll zuerst der **" | ||
- | < | ||
- | [root@archlinux ~]# rm / | ||
- | </ | ||
- | |||
- | Anschließend soll ein **__read-write__** - **Snapshot** vom aktuellen **Snapshot** von dem gerade gebootet wurde via [[http:// | ||
- | < | ||
- | [root@archlinux ~]# btrfs subvol snapshot / | ||
- | Create a snapshot of '/ | ||
- | </ | ||
- | |||
- | Der so erzeugte **__read-write__** **Snapshot** in nachfolgendem Verzeichnis mit nachfolgendem Namen | ||
- | * ''/ | ||
- | muss nun noch **umbenannt** werden, was mit nachfolgendem Befehl durchgeführt werden soll: | ||
- | < | ||
- | [root@archlinux ~]# mv / | ||
- | </ | ||
- | |||
- | Abschließend muss nun die [[https:// | ||
- | * ''/ | ||
- | noch entsprechend angepasst werden. | ||
- | |||
- | < | ||
- | [root@archlinux ~]# vim / | ||
- | </ | ||
- | |||
- | :!: **WICHTIG** - **'' | ||
- | |||
- | :!: **HINWEIS** - **Alle Einträge mit '' | ||
- | |||
- | Nachfolgend eine Liste der relevanten Stellen (**nur relevanter Ausschnitt**): | ||
- | |||
- | * <code ini> | ||
- | |||
- | Eine Suche im Editor nach '' | ||
- | |||
- | * <code ini> | ||
- | |||
- | **'' | ||
- | |||
- | * <code ini> | ||
- | |||
- | **'' | ||
- | |||
- | * <code ini> | ||
- | |||
- | **'' | ||
- | |||
- | * <code ini> | ||
- | |||
- | **'' | ||
- | |||
- | * <code ini> | ||
- | |||
- | **'' | ||
- | |||
- | * <code ini> | ||
- | |||
- | **'' | ||
- | |||
- | :!: **WICHTIG** - **Damit zukünftig von diesem Snapshot - __standardmässig__ gestartet wird, muss nachfolgender Befehl ausgeführt werden:** | ||
- | |||
- | Hier wird der **Bootloader** - hier [[https:// | ||
- | < | ||
- | [root@archlinux ~]# grub-install /dev/vda | ||
- | Installing for i386-pc platform. | ||
- | Installation finished. No error reported. | ||
- | </ | ||
- | |||
- | < | ||
- | [root@archlinux ~]# systemctl reboot | ||
- | </ | ||
- | |||
- | Nach einem Neustart, sollte nun wieder **'' | ||
- | |||
- | {{: | ||
- | |||
- | Eine Überprüfung, | ||
- | < | ||
- | [root@archlinux ~]# mount | grep /@root | ||
- | / | ||
- | </ | ||
- | |||
- | Anschließend soll das **Subvolume** - **''/'' | ||
- | < | ||
- | [root@archlinux ~]# btrfs subvolume set-default 0 / | ||
- | </ | ||
- | |||
- | Zur Überprüfung kann nachfolgende Befehl verwendet werden: | ||
- | < | ||
- | [root@archlinux ~]# btrfs subvolume get-default / | ||
- | ID 276 gen 100 top level 5 path @root | ||
- | </ | ||
- | |||
- | Nun können auch beispielsweise **alle** **Snapshots** mit nachfolgendem Befehl gelöscht werden: | ||
- | < | ||
- | [root@archlinux ~]# snapper delete 4 | ||
- | [root@archlinux ~]# snapper delete 3 | ||
- | [root@archlinux ~]# snapper delete 2 | ||
- | [root@archlinux ~]# snapper delete 1 | ||
- | </ | ||
- | |||
- | Abschließend würde dann die Anzeige aller **Snapshots** wie folgt aussehen: | ||
- | < | ||
- | [root@archlinux ~]# snapper list | ||
- | # | Type | Pre # | Date | User | Cleanup | Description | Userdata | ||
- | ---+--------+-------+------+------+---------+-------------+--------- | ||
- | 0 | single | | ||
- | </ | ||
- | |||
- | Auch die Anzeige des via **BtrfS** verwendeten Speicherplatzes zeigt nur die für **'' | ||
- | < | ||
- | [root@archlinux ~]# df -Th | grep /dev/mapper | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | </ | ||
- | bzw. | ||
- | < | ||
- | [root@archlinux ~]# btrfs filesystem df / | ||
- | Data, single: total=2.01GiB, | ||
- | System, DUP: total=8.00MiB, | ||
- | Metadata, DUP: total=256.00MiB, | ||
- | GlobalReserve, | ||
- | </ | ||
- | |||
- | :!: **WICHTIG** - **Damit zukünftig von diesem Snapshot - __standardmässig__ gestartet wird, muss nachfolgender Befehl ausgeführt werden:** | ||
- | |||
- | Hier wird der **Bootloader** - hier [[https:// | ||
- | < | ||
- | [root@archlinux ~]# grub-install /dev/vda | ||
- | Installing for i386-pc platform. | ||
- | Installation finished. No error reported. | ||
- | </ | ||
- | |||
- | Anschließend muss noch der **Bootloader** - hier [[https:// | ||
- | < | ||
- | [root@archlinux ~]# grub-mkconfig -o / | ||
- | Generating grub configuration file ... | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found fallback initrd image(s) in /boot: initramfs-linux-lts-fallback.img | ||
- | Detecting snapshots ... | ||
- | Info: Separate boot partition not detected | ||
- | Info: snapper detected, using config ' | ||
- | Found snapshot: 2020-12-07 18:25:56 | @root | ||
- | Found 1 snapshot(s) | ||
- | done | ||
- | </ | ||
tachtler/archlinux_-_minimal_server_installation_-_mit_lvm_und_btrfs_snapper.1657879668.txt.gz · Zuletzt geändert: 2022/07/15 12:07 von klaus