zfs
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| zfs [2022-11-21 12:15:55] – [ZFS mit Verschlüsselung] manfred | zfs [2025-12-10 17:26:41] (aktuell) – [ZFS-Snapshot erstellen] manfred | ||
|---|---|---|---|
| Zeile 6: | Zeile 6: | ||
| * ... Doch auch andere Betriebssysteme setzen nicht auf das Original-ZFS, | * ... Doch auch andere Betriebssysteme setzen nicht auf das Original-ZFS, | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | Linux: | ||
| + | > apt install zfsutils-linux zfsnap | ||
| + | |||
| + | FreeBSD //(Die ZFS-Tools sind bereits im FreeBSD-Basis-System enthalten)//: | ||
| + | > pkg install sysutils/ | ||
| + | |||
| + | |||
| + | ===== Allgemeines ===== | ||
| + | |||
| + | > zfs list -s used | ||
| + | > zfs list -S used | ||
| Zeile 26: | Zeile 41: | ||
| ==== ZFS mit Verschlüsselung ==== | ==== ZFS mit Verschlüsselung ==== | ||
| - | ZFS-Pool anlegen: | + | ZFS-Pool anlegen |
| > zpool create -m none HDD1000 /dev/sda | > zpool create -m none HDD1000 /dev/sda | ||
| > zpool list HDD1000 | > zpool list HDD1000 | ||
| Zeile 36: | Zeile 51: | ||
| HDD1000 | HDD1000 | ||
| - | ZFS-Volumen mit Verschlüsselung anlegen: | + | ZFS-Volumen mit Verschlüsselung anlegen |
| > zfs get 2>&1 | grep -Fi encryption | > zfs get 2>&1 | grep -Fi encryption | ||
| encryption | encryption | ||
| Zeile 65: | Zeile 80: | ||
| - | ==== ZFS resize ==== | + | ==== ZFS-Snapshot erstellen ==== |
| + | |||
| + | <file bash / | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # Dieses Skript macht von dem ZFS-Pool " | ||
| + | # | ||
| + | # Es kann maximal EINER pro Stunde angelegt werden, | ||
| + | # sollte für diesen Zeitraum bereits einer existieren, | ||
| + | # dann wird er vorher gelöscht. | ||
| + | # | ||
| + | # zfs snapshot mysql_datadir@4-16 | ||
| + | # zfs list -t snapshot mysql_datadir | ||
| + | # mount -t zfs mysql_datadir@7-16 /mnt | ||
| + | # zfs destroy mysql_datadir@4-16 | ||
| + | # | ||
| + | # Bedeutung von " | ||
| + | # mysql_datadir - ZFS-Pool (Tank) | ||
| + | # 4 - 4. Wochentag -> am Donnerstag aufgenommen | ||
| + | # 16 - zwischen 16:00 und 16:59 Uhr aufgenommen | ||
| + | # | ||
| + | |||
| + | SNAP_ZEIT=" | ||
| + | zfs list -Hp | awk '/ | ||
| + | do | ||
| + | echo "################################################################################" | ||
| + | echo " | ||
| + | zfs destroy ${SNAP}@${SNAP_ZEIT} | ||
| + | zfs snapshot ${SNAP}@${SNAP_ZEIT} | ||
| + | done | ||
| + | echo | ||
| + | |||
| + | # alle SnapShots anzeigen | ||
| + | zfs list -t snapshot | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== ZFS-Snapshot mounten ==== | ||
| + | |||
| + | <code bash> | ||
| + | root@mysqlhost01: | ||
| + | NAME | ||
| + | mysql_datadir@3-17 | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | Filesystem | ||
| + | mysql_datadir@3-17 | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | total 13K | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x 23 root root 4.0K Dec 9 15:39 .. | ||
| + | drwxr-xr-x | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | Filesystem | ||
| + | / | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | total 8.0K | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x 23 root root 4.0K Dec 9 15:39 .. | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== ZFS-Snapshot löschen ==== | ||
| + | |||
| + | <code bash> | ||
| + | root@mysqlhost01: | ||
| + | NAME | ||
| + | mysql_datadir@3-17 | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | no datasets available | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== ZFS-Pool | ||
| [[https:// | [[https:// | ||
| - | the resize is triggered by running the online subcommand with -e: | + | the resize is triggered by running the online subcommand with '' |
| - | # zpool online -e zroot /dev/ada0p2 | + | <code bash resize> |
| + | root@mysqlhost01: | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | |||
| + | root@mysqlhost01: | ||
| + | </ | ||
| Zeile 175: | Zeile 280: | ||
| Current status: 1 update [-1]. | Current status: 1 update [-1]. | ||
| + | |||
| + | |||
| + | ===== Beispiel ===== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | den Daten-Pool " | ||
| + | > zpool create speicher mirror /dev/ad7 /dev/ad8 | ||
| + | |||
| + | > zpool list speicher | ||
| + | > zpool iostat speicher | ||
| + | > zpool status speicher | ||
| + | |||
| + | alle Daten auf dem Pool überprüfen und ggf. reparieren: | ||
| + | > zpool scrub speicher | ||
| + | |||
| + | auf dem Daten-Pool " | ||
| + | > zfs create speicher/ | ||
| + | > zfs create speicher/ | ||
| + | > zfs create speicher/ | ||
| + | > zfs create speicher/ | ||
| + | |||
| + | die 4 ZFS-Volumen bekommen jeweils einen Mount-Point zugewiesen: | ||
| + | > zfs set mountpoint=/ | ||
| + | > zfs set mountpoint=/ | ||
| + | > zfs set mountpoint=/ | ||
| + | > zfs set mountpoint=/ | ||
| + | |||
| + | so kannst du eine doppelte Redundanz einstellen, das bringt deutlich mehr Datensicherheit | ||
| + | > zfs set copies=2 speicher/ | ||
| + | |||
| + | so kannst du Kompression einstellen: | ||
| + | > zfs set compression=gzip speicher/ | ||
| + | |||
| + | einen SnapShot von '' | ||
| + | > zfs snapshot speicher/ | ||
| + | |||
| + | alle SnapShots von '' | ||
| + | > zfs list -rt snapshot speicher/ | ||
| + | NAME USED AVAIL REFER MOUNTPOINT | ||
| + | speicher/ | ||
| + | |||
| + | den SnapShots mounten: | ||
| + | > mount -t zfs speicher/ | ||
| + | > ls -lha /mnt | ||
| + | > umount /mnt | ||
| + | |||
| + | den SnapShots löschen: | ||
| + | > zfs destroy speicher/ | ||
| + | | ||
| + | > zfs list -rt snapshot speicher/ | ||
| + | no datasets available | ||
| + | |||
| + | nur das eine ZFS-Volumen " | ||
| + | > zfs destroy -r speicher/ | ||
| + | |||
| + | alle ZFS-Volumen ('' | ||
| + | > zfs destroy -r speicher | ||
| + | |||
| + | den ganzen Daten-Pool " | ||
| + | > zpool destroy speicher | ||
/home/http/wiki/data/attic/zfs.1669032955.txt · Zuletzt geändert: von manfred
