Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Ubuntu Server 20.04 LTS - Minimal Server Installation - snapper - grub-btrfs
Die hier verwendete Installationsmethode ist eine Installation von einem USB-Stick. Es kommt die einzige verfügbare 64-bit-Variante von Ubuntu Server LTS in der Version 20.04 LTS zum Einsatz.
snapper ist ein Werkzeug zur Verwaltung von Linux-Dateisystem-Snapshots. Abgesehen von der offensichtlichen Erstellung und Löschung von Snapshots, kann snapper Snapshots vergleichen und Unterschiede zwischen Snapshots rückgängig machen. Vereinfacht ausgedrückt ermöglicht dies Root- und Nicht-Root-Benutzern, ältere Versionen von Dateien anzuzeigen und Änderungen rückgängig zu machen.
Beschreibung | Externer Link |
---|---|
Homepage | https://ubuntu.com/ |
Dokumentation | https://help.ubuntu.com/ |
Download | https://ubuntu.com/download/server |
* Quelle: Install Ubuntu 21.04 with btrfs + snapper + grub-btrfs
Ab hier werden root
-Rechte zur Ausführung der nachfolgenden Befehle benötigt.
1. Möglichkeit:
Um als Benutzer root
agieren zu können, geben Sie bitte vor den Befehlen immer den nachfolgenden Befehl ein:
$ sudo
2. Möglichkeit:
Ab hier werden root
-Rechte zur Ausführung der nachfolgenden Befehle benötigt. Um der Benutzer root
zu werden, geben Sie bitte nachfolgenden Befehl ein, um ein Passwort für den Benutzer root
zur localen Anmeldung zu erstellen:
Ubuntu 20.04.3 LTS ubuntu tty1 ubuntu login: klaus Password: Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.13.0-35-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Mon 14 Mar 2022 04:01:27 AM UTC System load: 0.0 Processes: 226 Usage of /home: unknown Users logged in: 1 Memory usage: 2% IPv4 address for enp1s0: 192.168.122.26 Swap usage: 0% 55 updates can be applied immediately. To see these additional updates run: apt list --upgradable Your Hardware Enablement Stack (HWE) is supported until April 2025. Last login: Mon Mar 14 04:01:13 2022 To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. klaus@ubuntu:~$ sudo passwd root [sudo] password for klaus: New password: Retype new password: passwd: password updated successfully klaus@ubuntu:~$ su - Password: root@ubuntu:~#
Voraussetzungen
Für die nachfolgende Installation wird vorausgesetzt,
- dass eine lauffähige Version von Ubuntu Server LTS mit dem Dateisystem: Btrfs vorhanden ist
- Das Betriebssystem auf den neusten Stand „upgagraded“ ist
Die unter nachfolgenden Link beschriebene Installation von Ubuntu Server LTS wird hier als Mindestvoraussetzung angenommen:
Betriebssystem: Update und Upgrade
Mit den drei nachfolgenden verketteten Befehlen, soll bevor jegliche weitere Installationen von Pakten erfolgen soll, das Betriebssystem auf den neusten Stand „upgagraded“ werden:
root@ubuntu:~# apt-get update && apt-get dist-upgrade && apt-get autoremove Hit:1 http://de.archive.ubuntu.com/ubuntu focal InRelease Hit:2 http://de.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 http://de.archive.ubuntu.com/ubuntu focal-backports InRelease Hit:4 http://de.archive.ubuntu.com/ubuntu focal-security InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'apt autoremove' to remove it. The following NEW packages will be installed: libfwupdplugin5 libmbim-glib4 libmbim-proxy libmm-glib0 libqmi-glib5 libqmi-proxy modemmanager usb-modeswitch usb-modeswitch-data The following packages will be upgraded: alsa-ucm-conf base-files cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf command-not-found fwupd fwupd-signed initramfs-tools initramfs-tools-bin initramfs-tools-core libasound2 libasound2-data libfwupd2 libjcat1 libnetplan0 libpam-modules libpam-modules-bin libpam-runtime libpam0g libprocps8 libssl1.1 libudisks2-0 linux-base motd-news-config netplan.io open-vm-tools openssl overlayroot procps python-apt-common python3-apt python3-commandnotfound python3-distupgrade python3-software-properties python3-update-manager rsync software-properties-common sosreport ubuntu-advantage-tools ubuntu-release-upgrader-core udisks2 ufw update-manager-core update-notifier-common wget 46 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 11.9 MB of archives. After this operation, 12.7 MB of additional disk space will be used. Do you want to continue? [Y/n] Y ... ... ... Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libfwupdplugin1 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 459 kB disk space will be freed. Do you want to continue? [Y/n] Y ... ... ... root@ubuntu:~#
Installation: grub-btrfs
Zum hinzufügen von Snapshots zum GRUB-Bootemenü ist die Nutzung des Pakets grub-btrfs erforderlich.
Mit nachfolgendem Befehlen,
- können die Voraussetzungen für eine Installation von grub-btrfs erfüllt werden und
- kann grub-btrfs kompiliert und installiert werden:
Voraussetzungen zur Installation von grub-btrfs installieren:
root@ubuntu:~# apt install build-essential git vim Reading package lists... Done Building dependency tree Reading state information... Done git is already the newest version (1:2.25.1-1ubuntu3.2). git set to manually installed. vim is already the newest version (2:8.1.2269-1ubuntu5.7). vim set to manually installed. The following additional packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev Suggested packages: binutils-doc cpp-doc gcc-9-locales debian-keyring g++-multilib g++-9-multilib gcc-9-doc gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-9-multilib glibc-doc bzr libstdc++-9-doc make-doc The following NEW packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev 0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded. Need to get 45.4 MB of archives. After this operation, 202 MB of additional disk space will be used. Do you want to continue? [Y/n] Y ... ... ... root@ubuntu:~#
Code von grub-btrfs klonen:
root@ubuntu:~# git clone https://github.com/Antynea/grub-btrfs.git Cloning into 'grub-btrfs'... remote: Enumerating objects: 844, done. remote: Counting objects: 100% (151/151), done. remote: Compressing objects: 100% (125/125), done. remote: Total 844 (delta 95), reused 42 (delta 26), pack-reused 693 Receiving objects: 100% (844/844), 257.99 KiB | 4.45 MiB/s, done. Resolving deltas: 100% (494/494), done. root@ubuntu:~#
In das geklonte Verzeichnis wechseln:
root@ubuntu:~# cd grub-btrfs
Kompilieren und Installieren:
root@ubuntu:~/grub-btrfs# make -d install GNU Make 4.2.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Reading makefile 'Makefile'... Updating makefiles.... ... ... ... Successfully remade target file 'install'. root@ubuntu:~/grub-btrfs#
Verlassen des geklonte Verzeichnisses:
root@ubuntu:~/grub-btrfs# cd root@ubuntu:~#
Installation: snapper
Zum erstellen von Snapshots ist die Nutzung des Programms snapper erforderlich.
Mit nachfolgendem Befehl, kann snapper installiert werden:
root@ubuntu:~# apt-get install snapper Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libboost-thread1.71.0 libbtrfs0 libsnapper4 The following NEW packages will be installed: libboost-thread1.71.0 libbtrfs0 libsnapper4 snapper 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 1,102 kB of archives. After this operation, 5,830 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libboost-thread1.71.0 amd64 1.71.0-6ubuntu6 [249 kB] Get:2 http://de.archive.ubuntu.com/ubuntu focal/main amd64 libbtrfs0 amd64 5.4.1-2 [175 kB] Get:3 http://de.archive.ubuntu.com/ubuntu focal/universe amd64 libsnapper4 amd64 0.8.6-1build1 [269 kB] Get:4 http://de.archive.ubuntu.com/ubuntu focal/universe amd64 snapper amd64 0.8.6-1build1 [410 kB] Fetched 1,102 kB in 0s (2,214 kB/s) Selecting previously unselected package libboost-thread1.71.0:amd64. (Reading database ... 70494 files and directories currently installed.) Preparing to unpack .../libboost-thread1.71.0_1.71.0-6ubuntu6_amd64.deb ... Unpacking libboost-thread1.71.0:amd64 (1.71.0-6ubuntu6) ... Selecting previously unselected package libbtrfs0:amd64. Preparing to unpack .../libbtrfs0_5.4.1-2_amd64.deb ... Unpacking libbtrfs0:amd64 (5.4.1-2) ... Selecting previously unselected package libsnapper4:amd64. Preparing to unpack .../libsnapper4_0.8.6-1build1_amd64.deb ... Unpacking libsnapper4:amd64 (0.8.6-1build1) ... Selecting previously unselected package snapper. Preparing to unpack .../snapper_0.8.6-1build1_amd64.deb ... Unpacking snapper (0.8.6-1build1) ... Setting up libbtrfs0:amd64 (5.4.1-2) ... Setting up libboost-thread1.71.0:amd64 (1.71.0-6ubuntu6) ... Setting up libsnapper4:amd64 (0.8.6-1build1) ... Setting up snapper (0.8.6-1build1) ... Created symlink /etc/systemd/system/timers.target.wants/snapper-boot.timer → /lib/systemd/system/snapper-boot.timer. Created symlink /etc/systemd/system/timers.target.wants/snapper-cleanup.timer → /lib/systemd/system/snapper-cleanup.timer. Created symlink /etc/systemd/system/timers.target.wants/snapper-timeline.timer → /lib/systemd/system/snapper-timeline.timer. snapper-boot.service is a disabled or a static unit, not starting it. snapper-cleanup.service is a disabled or a static unit, not starting it. snapper-timeline.service is a disabled or a static unit, not starting it. Processing triggers for man-db (2.9.1-1) ... Processing triggers for dbus (1.12.16-2ubuntu2.1) ... Processing triggers for libc-bin (2.31-0ubuntu9.7) ... root@ubuntu:~#
Nachfolgender Befehl listete den Inhalt des installierten Pakets - snapper - auf:
root@ubuntu:~# dpkg-query -L snapper /. /etc /etc/apt /etc/apt/apt.conf.d /etc/apt/apt.conf.d/80snapper /etc/dbus-1 /etc/dbus-1/system.d /etc/dbus-1/system.d/org.opensuse.Snapper.conf /etc/default /etc/default/snapper /etc/logrotate.d /etc/logrotate.d/snapper /etc/snapper /etc/snapper/config-templates /etc/snapper/config-templates/default /etc/snapper/configs /etc/snapper/filters /etc/snapper/filters/base.txt /etc/snapper/filters/lvm.txt /etc/snapper/filters/x11.txt /lib /lib/systemd /lib/systemd/system /lib/systemd/system/snapper-boot.service /lib/systemd/system/snapper-boot.timer /lib/systemd/system/snapper-cleanup.service /lib/systemd/system/snapper-cleanup.timer /lib/systemd/system/snapper-timeline.service /lib/systemd/system/snapper-timeline.timer /usr /usr/bin /usr/bin/snapper /usr/lib /usr/lib/snapper /usr/lib/snapper/installation-helper /usr/lib/snapper/systemd-helper /usr/sbin /usr/sbin/mksubvolume /usr/sbin/snapperd /usr/share /usr/share/bash-completion /usr/share/bash-completion/completions /usr/share/bash-completion/completions/snapper /usr/share/dbus-1 /usr/share/dbus-1/system-services /usr/share/dbus-1/system-services/org.opensuse.Snapper.service /usr/share/doc /usr/share/doc/snapper /usr/share/doc/snapper/AUTHORS /usr/share/doc/snapper/copyright /usr/share/doc/snapper/dbus-protocol.txt /usr/share/locale /usr/share/locale/af /usr/share/locale/af/LC_MESSAGES /usr/share/locale/af/LC_MESSAGES/snapper.mo /usr/share/locale/ar /usr/share/locale/ar/LC_MESSAGES /usr/share/locale/ar/LC_MESSAGES/snapper.mo /usr/share/locale/be /usr/share/locale/be/LC_MESSAGES /usr/share/locale/be/LC_MESSAGES/snapper.mo /usr/share/locale/bg /usr/share/locale/bg/LC_MESSAGES /usr/share/locale/bg/LC_MESSAGES/snapper.mo /usr/share/locale/bn /usr/share/locale/bn/LC_MESSAGES /usr/share/locale/bn/LC_MESSAGES/snapper.mo /usr/share/locale/bs /usr/share/locale/bs/LC_MESSAGES /usr/share/locale/bs/LC_MESSAGES/snapper.mo /usr/share/locale/ca /usr/share/locale/ca/LC_MESSAGES /usr/share/locale/ca/LC_MESSAGES/snapper.mo /usr/share/locale/cs /usr/share/locale/cs/LC_MESSAGES /usr/share/locale/cs/LC_MESSAGES/snapper.mo /usr/share/locale/cy /usr/share/locale/cy/LC_MESSAGES /usr/share/locale/cy/LC_MESSAGES/snapper.mo /usr/share/locale/da /usr/share/locale/da/LC_MESSAGES /usr/share/locale/da/LC_MESSAGES/snapper.mo /usr/share/locale/de /usr/share/locale/de/LC_MESSAGES /usr/share/locale/de/LC_MESSAGES/snapper.mo /usr/share/locale/el /usr/share/locale/el/LC_MESSAGES /usr/share/locale/el/LC_MESSAGES/snapper.mo /usr/share/locale/en_GB /usr/share/locale/en_GB/LC_MESSAGES /usr/share/locale/en_GB/LC_MESSAGES/snapper.mo /usr/share/locale/en_US /usr/share/locale/en_US/LC_MESSAGES /usr/share/locale/en_US/LC_MESSAGES/snapper.mo /usr/share/locale/eo /usr/share/locale/eo/LC_MESSAGES /usr/share/locale/eo/LC_MESSAGES/snapper.mo /usr/share/locale/es /usr/share/locale/es/LC_MESSAGES /usr/share/locale/es/LC_MESSAGES/snapper.mo /usr/share/locale/et /usr/share/locale/et/LC_MESSAGES /usr/share/locale/et/LC_MESSAGES/snapper.mo /usr/share/locale/eu /usr/share/locale/eu/LC_MESSAGES /usr/share/locale/eu/LC_MESSAGES/snapper.mo /usr/share/locale/fa /usr/share/locale/fa/LC_MESSAGES /usr/share/locale/fa/LC_MESSAGES/snapper.mo /usr/share/locale/fi /usr/share/locale/fi/LC_MESSAGES /usr/share/locale/fi/LC_MESSAGES/snapper.mo /usr/share/locale/fr /usr/share/locale/fr/LC_MESSAGES /usr/share/locale/fr/LC_MESSAGES/snapper.mo /usr/share/locale/gl /usr/share/locale/gl/LC_MESSAGES /usr/share/locale/gl/LC_MESSAGES/snapper.mo /usr/share/locale/gu /usr/share/locale/gu/LC_MESSAGES /usr/share/locale/gu/LC_MESSAGES/snapper.mo /usr/share/locale/he /usr/share/locale/he/LC_MESSAGES /usr/share/locale/he/LC_MESSAGES/snapper.mo /usr/share/locale/hi /usr/share/locale/hi/LC_MESSAGES /usr/share/locale/hi/LC_MESSAGES/snapper.mo /usr/share/locale/hr /usr/share/locale/hr/LC_MESSAGES /usr/share/locale/hr/LC_MESSAGES/snapper.mo /usr/share/locale/hu /usr/share/locale/hu/LC_MESSAGES /usr/share/locale/hu/LC_MESSAGES/snapper.mo /usr/share/locale/id /usr/share/locale/id/LC_MESSAGES /usr/share/locale/id/LC_MESSAGES/snapper.mo /usr/share/locale/it /usr/share/locale/it/LC_MESSAGES /usr/share/locale/it/LC_MESSAGES/snapper.mo /usr/share/locale/ja /usr/share/locale/ja/LC_MESSAGES /usr/share/locale/ja/LC_MESSAGES/snapper.mo /usr/share/locale/ka /usr/share/locale/ka/LC_MESSAGES /usr/share/locale/ka/LC_MESSAGES/snapper.mo /usr/share/locale/km /usr/share/locale/km/LC_MESSAGES /usr/share/locale/km/LC_MESSAGES/snapper.mo /usr/share/locale/ko /usr/share/locale/ko/LC_MESSAGES /usr/share/locale/ko/LC_MESSAGES/snapper.mo /usr/share/locale/ku /usr/share/locale/ku/LC_MESSAGES /usr/share/locale/ku/LC_MESSAGES/snapper.mo /usr/share/locale/lo /usr/share/locale/lo/LC_MESSAGES /usr/share/locale/lo/LC_MESSAGES/snapper.mo /usr/share/locale/lt /usr/share/locale/lt/LC_MESSAGES /usr/share/locale/lt/LC_MESSAGES/snapper.mo /usr/share/locale/mk /usr/share/locale/mk/LC_MESSAGES /usr/share/locale/mk/LC_MESSAGES/snapper.mo /usr/share/locale/mr /usr/share/locale/mr/LC_MESSAGES /usr/share/locale/mr/LC_MESSAGES/snapper.mo /usr/share/locale/nb /usr/share/locale/nb/LC_MESSAGES /usr/share/locale/nb/LC_MESSAGES/snapper.mo /usr/share/locale/nds /usr/share/locale/nds/LC_MESSAGES /usr/share/locale/nds/LC_MESSAGES/snapper.mo /usr/share/locale/nl /usr/share/locale/nl/LC_MESSAGES /usr/share/locale/nl/LC_MESSAGES/snapper.mo /usr/share/locale/nn /usr/share/locale/nn/LC_MESSAGES /usr/share/locale/nn/LC_MESSAGES/snapper.mo /usr/share/locale/pa /usr/share/locale/pa/LC_MESSAGES /usr/share/locale/pa/LC_MESSAGES/snapper.mo /usr/share/locale/pl /usr/share/locale/pl/LC_MESSAGES /usr/share/locale/pl/LC_MESSAGES/snapper.mo /usr/share/locale/pt /usr/share/locale/pt/LC_MESSAGES /usr/share/locale/pt/LC_MESSAGES/snapper.mo /usr/share/locale/pt_BR /usr/share/locale/pt_BR/LC_MESSAGES /usr/share/locale/pt_BR/LC_MESSAGES/snapper.mo /usr/share/locale/ro /usr/share/locale/ro/LC_MESSAGES /usr/share/locale/ro/LC_MESSAGES/snapper.mo /usr/share/locale/ru /usr/share/locale/ru/LC_MESSAGES /usr/share/locale/ru/LC_MESSAGES/snapper.mo /usr/share/locale/si /usr/share/locale/si/LC_MESSAGES /usr/share/locale/si/LC_MESSAGES/snapper.mo /usr/share/locale/sk /usr/share/locale/sk/LC_MESSAGES /usr/share/locale/sk/LC_MESSAGES/snapper.mo /usr/share/locale/sl /usr/share/locale/sl/LC_MESSAGES /usr/share/locale/sl/LC_MESSAGES/snapper.mo /usr/share/locale/sr /usr/share/locale/sr/LC_MESSAGES /usr/share/locale/sr/LC_MESSAGES/snapper.mo /usr/share/locale/sv /usr/share/locale/sv/LC_MESSAGES /usr/share/locale/sv/LC_MESSAGES/snapper.mo /usr/share/locale/ta /usr/share/locale/ta/LC_MESSAGES /usr/share/locale/ta/LC_MESSAGES/snapper.mo /usr/share/locale/tg /usr/share/locale/tg/LC_MESSAGES /usr/share/locale/tg/LC_MESSAGES/snapper.mo /usr/share/locale/th /usr/share/locale/th/LC_MESSAGES /usr/share/locale/th/LC_MESSAGES/snapper.mo /usr/share/locale/tr /usr/share/locale/tr/LC_MESSAGES /usr/share/locale/tr/LC_MESSAGES/snapper.mo /usr/share/locale/uk /usr/share/locale/uk/LC_MESSAGES /usr/share/locale/uk/LC_MESSAGES/snapper.mo /usr/share/locale/vi /usr/share/locale/vi/LC_MESSAGES /usr/share/locale/vi/LC_MESSAGES/snapper.mo /usr/share/locale/wa /usr/share/locale/wa/LC_MESSAGES /usr/share/locale/wa/LC_MESSAGES/snapper.mo /usr/share/locale/xh /usr/share/locale/xh/LC_MESSAGES /usr/share/locale/xh/LC_MESSAGES/snapper.mo /usr/share/locale/zh_CN /usr/share/locale/zh_CN/LC_MESSAGES /usr/share/locale/zh_CN/LC_MESSAGES/snapper.mo /usr/share/locale/zh_TW /usr/share/locale/zh_TW/LC_MESSAGES /usr/share/locale/zh_TW/LC_MESSAGES/snapper.mo /usr/share/locale/zu /usr/share/locale/zu/LC_MESSAGES /usr/share/locale/zu/LC_MESSAGES/snapper.mo /usr/share/man /usr/share/man/man5 /usr/share/man/man5/snapper-configs.5.gz /usr/share/man/man8 /usr/share/man/man8/mksubvolume.8.gz /usr/share/man/man8/pam_snapper.8.gz /usr/share/man/man8/snapper.8.gz /usr/share/man/man8/snapperd.8.gz /usr/share/doc/snapper/changelog.Debian.gz
Konfiguration: snapper
snapper: root
Nach der erfolgreichen Installation von snapper, soll dieser so konfiguriert werden, dass vom Btrfs: Subvolume - /
(root) - Snapshots erstellt werden können.
Dazu ist die Anlage einer Konfiguration für das Btrfs: Subvolume - /
(root) erforderlich, welche mit nachfolgendem Befehl erzeugt werden kann:
root@ubuntu:~# snapper -c root create-config /
Die so neu erstellte Konfigurationsdatei ist in nachfolgendem Verzeichnis mit nachfolgendem Namen root
zu finden:
/etc/snapper/configs/root
Mit der Erstellung der Konfiguration für das Btrfs: Subvolume - /
(root), wird auch ein Btrfs: Unter-Subvolume, mit der Bezeichnung
.snapshots
erstellt, wie nachfolgender Befehl zeigt:
root@ubuntu:~# btrfs subvolume list / ID 260 gen 45 top level 5 path .snapshots
Jetzt muss die Konfigurationsdatei
/etc/fstab
wie folgt erweitert werden, so dass das neue Verzeichnis /.snapshots
auch auf das mit der ursprünglichen Installation angelegtes Btrfs: Subvolume /.snapshots
(welches ein eigenes Btrfs: Unter-Subvolume ist), automatisch bei jedem Start mit gemounttet wird:
root@ubuntu:~# vim /etc/fstab
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFUvEuLj3lVx2mvdf3Bi8S927agHLToSbbb none swap sw 0 0 # / was on /dev/vg/root during curtin installation /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFU1bkGHaI6eHtV587sdPBMKrHaVRgC5K1H / btrfs defaults 0 1 # Tachtler - NEW - /.snapshots was on /dev/vg/root /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFU1bkGHaI6eHtV587sdPBMKrHaVRgC5K1H /.snapshots btrfs defaults 0 1 # /boot was on /dev/vda2 during curtin installation /dev/disk/by-uuid/bb9b7646-4038-4766-9191-37299b304f0b /boot btrfs defaults 0 1 # /home was on /dev/vg/home during curtin installation /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFUIEN3P24xZKba8guaYyo2BW0oTrg4bZf6 /home btrfs defaults 0 1 # /var was on /dev/vg/var during curtin installation /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFUxn10qyWYdImbLEKWiJhNrF4MxFYS8KQv /var xfs defaults 0 1 # /var/log was on /dev/vg/var_log during curtin installation /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFUvb1zBsc31slk47eWfR72e2PAKCP4HCnc /var/log xfs defaults 0 1
*Der Eintrag bei # Tachtler - NEW - /.snapshots was on /dev/vg/root
ist hinzugekommen!
Erklärung
# Tachtler - NEW - /.snapshots was on /dev/vg/root /dev/disk/by-id/dm-uuid-LVM-MpbaSu8tv7gm7ZffAjQw0EJBe0Y68CFU1bkGHaI6eHtV587sdPBMKrHaVRgC5K1H /.snapshots btrfs defaults 0 1
Hinzufügen eines Mount-Points (Einhängepunktes im Dateisystem) für das Btrfs: Subvolume - snapshots
auf das Verzeichnis /.snapshots
.
Um den in der Konfigurationsdatei /etc/fstab
neu hinzugefügten Eintrag per Hand zu aktivieren, was sonst ja mit dem Starten des Betriebssystems erfolgen wird, kann nachfolgender Befehl verwendet werden:
[root@archlinux ~]# mount /.snapshots
Ob das mounten von Hand erfolgreich war, kann mit nachfolgendem Befehl überprüft werden:
root@ubuntu:~# mount | grep /dev/mapper/ /dev/mapper/vg-root on / type btrfs (rw,relatime,space_cache,subvolid=5,subvol=/) /dev/mapper/vg-home on /home type btrfs (rw,relatime,space_cache,subvolid=5,subvol=/) /dev/mapper/vg-var on /var type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota) /dev/mapper/vg-var_log on /var/log type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota) /dev/mapper/vg-root on /.snapshots type btrfs (rw,relatime,space_cache,subvolid=5,subvol=/) root@ubuntu:~#
*Der letzte Eintrag ist hinzugekommen!
Um sicher zu gehen, das snapper auch weiterhin korrekt funktioniert, kann nachfolgender Befehl verwendet werden, welche den aktuellen Status aller Snapshots auflistet:
root@ubuntu:~# snapper list # | Type | Pre # | Date | User | Cleanup | Description | Userdata ---+--------+-------+------+------+---------+-------------+--------- 0 | single | | | root | | current | root@ubuntu:~#
/etc/snapper/configs/root
Nachfolgende Einstellungen passen das Verhalten von snapper an.
- 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@ubuntu:~# vim /etc/snapper/configs/root