ZFS
Siehe auch
ZFS benötigt RAM. Eine gute Regel zur Berechung ist 5 GB RAM pro TB Disk Space. Bei Verwendung von Features wie Deduplication wächst der Memory-Bedarf nochmal an. ZFS hat die Major-ID 230 zvol.
ZFS ist kein integraler Bestandteil von RHEL, und wird daher hier als separate Software kategorisiert.
Installation
Bemerkung
DKMS (Dynamic Kernel Module Support) oder kABI? Von der Homepage des ZFS-Projekts:
DKMS packages are recommended for users running a non-distribution kernel or for users who wish to apply local customizations to OpenZFS. For most users the kABI-tracking kmod packages are recommended in order to avoid needing to rebuild OpenZFS for every kernel update.
Am Beispiel von RHEL 8 kABI-Variante installieren:
dnf -y install https://zfsonlinux.org/epel/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm
# kABI method
dnf config-manager --disable zfs
dnf config-manager --enable zfs-kmod
dnf -y install zfs
systemctl preset zfs-import-cache zfs-import-scan zfs-mount zfs-share zfs-zed zfs.target
echo zfs > /etc/modules-load.d/zfs.conf
reboot
Unit-Test ausführen. Dieser dauert 5 Minuten. Wichtig ist am Ende die Ausgabe von „no leaks“:
ztest --vdev-file-directory= /tmp -VVV
ZFS-Pool einrichten
Für die verschiedenen Festplatten-Konzepte wie Mirror, RAID etc. siehe man zpoolconcepts. Festplatten, die einem Pool zugeordnet sind, können nicht mehr einem anderen Pool zugeordnet werden.
Pool namens „data“ anlegen:
# raidz2 requires at least 3 devices
zpool create data raidz2 /dev/vd[b-d]
Das Verzeichnis /data wird automatisch angelegt und ist auch nach einem Reboot verfügbar.
zpool list -v
Ausgabe:
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
data 2.75G 333K 2.75G - - 0% 0% 1.00x ONLINE -
raidz2-0 2.75G 333K 2.75G - - 0% 0.01% - ONLINE
vdb 1.99G - - - - - - - ONLINE
vdc 2.99G - - - - - - - ONLINE
vdd 1014M - - - - - - - ONLINE
ZFS Cheat Sheet
Disk für das Caching definieren:
zpool add data cache /dev/nvme0n1p1
Hot Swap und Ersatz mit grösseren Platten ermöglichen:
zpool set autoreplace=on data
zpool set autoexpand=on data
Einstellungen werden an alle Unterpools weitervererbt:
zfs set compression=lz4 data
# needs massive amount of RAM
zfs set dedup=sha256 data/pictures
Pool anlegen:
zfs create data/backup/user
Zustand abfragen:
zpool list -v
zpool get all data
zpool iostat -v data
zfs get all data/backup/user
Pool auf Fehler prüfen (sehr I/O-intensiv):
# put this in a scheduler like systemd-timer
zpool scrub data
ZFS und NFS
Auf Seite des ZFS-Servers:
dnf -y install nfs-utils
systemctl enable nfs-server
systemctl start nfs-server
zfs set sharenfs="rw=@192.0.2.26/32" backup/user/linuxfabrik
Auf Client-Seite, als root:
mkdir -p /mnt/backup
mount 192.0.2.52:/backup/user/linuxfabrik /mnt/backup
Built on 2025-10-27