Skip to content

ZFS - Wichtige Befehle

Linux
2 1 868
  • zpool - configure ZFS storage pools

    Ein paar der wichtigsten Befehle, die ich so die letzten Tage kennengelernt und benutzt habe. Wird bei Bedarf erweitert.

    zpool create

    Hiermit bauen wir einen ZFS Pool aus zwei Platten auf.

    zpool create ZFS-Pool ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    

    zpool status

    Zeigt uns den Status des Pools an, welche Platten, Zustand usw.

    root@pve:~# zpool status
      pool: ZFS-Pool
     state: ONLINE
      scan: resilvered 1.20T in 02:56:31 with 0 errors on Mon Oct 18 18:28:36 2021
    config:
    
    	NAME                                          STATE     READ WRITE CKSUM
    	ZFS-Pool                                      ONLINE       0     0     0
    	  mirror-0                                    ONLINE       0     0     0
    	    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26  ONLINE       0     0     0
    	    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52  ONLINE       0     0     0
    
    errors: No known data errors
    

    zpool attach

    Hiermit fügen wir eine oder mehrere Platten zu einem Pool hinzu.

    zpool attach ZFS-Pool ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    

    zpool detach

    Das entfernt eine Platte aus dem Pool.

    zpool detach ZFS-Pool 8992518921607088473
    

    zpool replace

    Eine Platte, die z.B. ausgefallen ist, wird hiermit ersetzt.

    zpool replace ZFS-Pool ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    

    zfs - configures ZFS file systems


    zfs list

    Listet den Inhalt des ZFS Filesystemes.

    root@pve:~# zfs list -t filesystem -o name,used
    NAME                  USED
    ZFS-Pool              418G
    ZFS-Pool/nas_backup   384G
    

    oder

    root@pve:~# zfs list
    NAME                     USED  AVAIL     REFER  MOUNTPOINT
    ZFS-Pool                 418G  3.10T     1.50G  /ZFS-Pool
    ZFS-Pool/nas_backup      384G  3.10T      384G  /ZFS-Pool/nas_backup
    ZFS-Pool/vm-100-disk-0  33.0G  3.13T     3.17G  -
    

    oder

    gibt alle Parameter aus, was für Experten 😉

    root@pve:~# zfs get all ZFS-Pool
    NAME      PROPERTY              VALUE                  SOURCE
    ZFS-Pool  type                  filesystem             -
    ZFS-Pool  creation              Sat Oct 16 10:50 2021  -
    ZFS-Pool  used                  418G                   -
    ZFS-Pool  available             3.10T                  -
    ZFS-Pool  referenced            1.50G                  -
    ZFS-Pool  compressratio         1.01x                  -
    ZFS-Pool  mounted               yes                    -
    ZFS-Pool  quota                 none                   default
    ZFS-Pool  reservation           none                   default
    ZFS-Pool  recordsize            128K                   default
    ZFS-Pool  mountpoint            /ZFS-Pool              default
    ZFS-Pool  sharenfs              off                    default
    ZFS-Pool  checksum              on                     default
    ZFS-Pool  compression           on                     local
    ZFS-Pool  atime                 on                     default
    ZFS-Pool  devices               on                     default
    ZFS-Pool  exec                  on                     default
    ZFS-Pool  setuid                on                     default
    ZFS-Pool  readonly              off                    default
    ZFS-Pool  zoned                 off                    default
    ZFS-Pool  snapdir               hidden                 default
    ZFS-Pool  aclmode               discard                default
    ZFS-Pool  aclinherit            restricted             default
    ZFS-Pool  createtxg             1                      -
    ZFS-Pool  canmount              on                     default
    ZFS-Pool  xattr                 on                     default
    ZFS-Pool  copies                1                      default
    ZFS-Pool  version               5                      -
    ZFS-Pool  utf8only              off                    -
    ZFS-Pool  normalization         none                   -
    ZFS-Pool  casesensitivity       sensitive              -
    ZFS-Pool  vscan                 off                    default
    ZFS-Pool  nbmand                off                    default
    ZFS-Pool  sharesmb              off                    default
    ZFS-Pool  refquota              none                   default
    ZFS-Pool  refreservation        none                   default
    ZFS-Pool  guid                  16136524096267552939   -
    ZFS-Pool  primarycache          all                    default
    ZFS-Pool  secondarycache        all                    default
    ZFS-Pool  usedbysnapshots       0B                     -
    ZFS-Pool  usedbydataset         1.50G                  -
    ZFS-Pool  usedbychildren        417G                   -
    ZFS-Pool  usedbyrefreservation  0B                     -
    ZFS-Pool  logbias               latency                default
    ZFS-Pool  objsetid              54                     -
    ZFS-Pool  dedup                 off                    default
    ZFS-Pool  mlslabel              none                   default
    ZFS-Pool  sync                  standard               default
    ZFS-Pool  dnodesize             legacy                 default
    ZFS-Pool  refcompressratio      1.00x                  -
    ZFS-Pool  written               1.50G                  -
    ZFS-Pool  logicalused           394G                   -
    ZFS-Pool  logicalreferenced     1.50G                  -
    ZFS-Pool  volmode               default                default
    ZFS-Pool  filesystem_limit      none                   default
    ZFS-Pool  snapshot_limit        none                   default
    ZFS-Pool  filesystem_count      none                   default
    ZFS-Pool  snapshot_count        none                   default
    ZFS-Pool  snapdev               hidden                 default
    ZFS-Pool  acltype               off                    default
    ZFS-Pool  context               none                   default
    ZFS-Pool  fscontext             none                   default
    ZFS-Pool  defcontext            none                   default
    ZFS-Pool  rootcontext           none                   default
    ZFS-Pool  relatime              off                    default
    ZFS-Pool  redundant_metadata    all                    default
    ZFS-Pool  overlay               on                     default
    ZFS-Pool  encryption            off                    default
    ZFS-Pool  keylocation           none                   default
    ZFS-Pool  keyformat             none                   default
    ZFS-Pool  pbkdf2iters           0                      default
    ZFS-Pool  special_small_blocks  0                      default
    

    zfs create

    Legt ein Dataset an. Das kann man sich wie einen Ordner vorstellen.

    A dataset is a space where you put your data. Datasets are flexible in size and are located inside your pool.

    zfs create <Pool_Name>/<dataset>
    

    zfs snapshot

    zfs snapshot datapool/test@today
    

    zfs list

    root@pbs:/mnt/datastore/datapool/test# zfs list -t snapshot
    NAME                  USED  AVAIL     REFER  MOUNTPOINT
    datapool/test@today     0B      -       96K  -
    

    Die Anleitung zum Thema -> https://openzfs.github.io/openzfs-docs/index.html

    Interessante Links zum Thema

  • Unter dem Beitrag sammel ich mal ein paar Beispiele, für mich zum Nachlesen 🙂

    Den Anfang macht die

    ZFS-Replication

    Ich hatte Am Anfang ein wenig Verständnisprobleme, bis es klar war, das diese Replication von Pool zu Pool funktioniert. Also brauchen wir zwei vorhandene ZFS-Pools.

    root@pbs:/mnt/datastore/datapool/test# zfs list
    NAME                    USED  AVAIL     REFER  MOUNTPOINT
    Backup_Home             222G   677G      222G  /mnt/datastore/Backup_Home
    datapool                2.36G  1.75T     2.36G  /mnt/datastore/datapool
    

    Wir erzeugen ein Dataset im datapool

    zfs create datapool/docs -o mountpoint=/docs
    

    Wir erzeugen eine Datei mit Inhalt

    echo "version 1" > /docs/data.txt
    

    Wir erzeugen einen Snapshot

    zfs snapshot datapool/docs@today
    

    Kontrolle

    root@pbs:/mnt/datastore/datapool/test# zfs list -t snapshot
    NAME                          USED  AVAIL     REFER  MOUNTPOINT
    datapool/docs@today             0B      -       96K  -
    

    Wir replizieren den vorhandenen Snapshot zum ZFS-Pool Backup_Home und speichern ihn da im Dataset test.

    zfs send datapool/docs@today | zfs receive Backup_Home/test
    

    Nun befinden sich die Daten in dem anderen ZFS-Pool

    root@pbs:/mnt/datastore/datapool/test# ls /mnt/datastore/Backup_Home/test/
    data.txt
    

    Und was mich am meisten interessiert, ist wie man das zu einem anderen Server schickt 😉

    zfs send datapool/docs@today | ssh otherserver zfs receive backuppool/backup
    

    Den Test reiche ich dann später nach.

    Quelle: https://www.howtoforge.com/tutorial/how-to-use-snapshots-clones-and-replication-in-zfs-on-linux/

    ZFS inkrementelle Replication

    Als, nur die geänderten Daten senden!

    Wir erzeugen ein paar Dateien

    root@pbs:/mnt/datastore/datapool/test# echo "data" > /docs/data1.txt
    root@pbs:/mnt/datastore/datapool/test# echo "data" > /docs/data2.txt
    root@pbs:/mnt/datastore/datapool/test# echo "data" > /docs/data3.txt
    root@pbs:/mnt/datastore/datapool/test# echo "data" > /docs/data4.txt
    

    Neuer Snapshot

    zfs snapshot datapool/docs@17:02
    

    Liste der Snapshots

    root@pbs:/mnt/datastore/datapool/test# zfs list -t snapshot
    NAME                          USED  AVAIL     REFER  MOUNTPOINT
    datapool/docs@today            56K      -       96K  -
    datapool/docs@17:02             0B      -      112K  -
    

    Wir senden dieinkrementelle Replication

    zfs send -vi datapool/docs@today datapool/docs@17:02 | zfs receive Backup_Home/test
    send from datapool/docs@today to datapool/docs@17:02 estimated size is 38.6K
    total estimated size is 38.6K
    cannot receive incremental stream: destination Backup_Home/test has been modified
    since most recent snapshot
    

    Dazu schreibt die Anleitung, die ich unten verlinkt habe, das die Daten verändert wurden. Warum, verstehe ich aktuell noch nicht. Mit -F im send Befehl erzwingt man einen Rollback zum letzten Snapshot.

    zfs send -vi datapool/docs@today datapool/docs@17:02 | zfs receive -F Backup_Home/test
    send from datapool/docs@today to datapool/docs@17:02 estimated size is 38.6K
    total estimated size is 38.6K
    

    Und Kontrolle

    ls /mnt/datastore/Backup_Home/test/
    data1.txt  data2.txt  data3.txt  data4.txt  data.txt   
    

    Quelle: https://klarasystems.com/articles/introduction-to-zfs-replication/

  • KDE Plasma 6 - Beta 2

    Linux kde linux
    2
    0 Stimmen
    2 Beiträge
    249 Aufrufe
    FrankMF
    Leider hat die Realität mich etwas vom Testen neuer Software abgehalten, aber jetzt geht es langsam wieder los. Den Start macht KDE Plasma 6 - Beta 2. Auch wenn ich schon brennend auf die RC1 warte, die lässt aber noch auf sich warten... https://pointieststick.com/category/this-week-in-kde/ Ok, also die Beta 2 auf meinen Stick und ab damit in mein Testsystem. Einmal starten, kurz danach taucht der KDE Neon Desktop auf. [image: 1705002299148-20240110_201838-resized.jpg] [image: 1705002324795-20240110_201852-resized.jpg] Und klick, wird die Installation gestartet. Danach begrüßt uns dieses Fenster. Ich weiß nicht, warum diese Information nicht automatisch ermittelt wird - nervig. [image: 1705002522434-20240110_201924-resized.jpg] Der Rest der Installation lief einwandfrei, ich habe aber keine besondere Installation vorgenommen. Ganze NVMe plattgemacht und alles drauf. Nichts verschlüsselt usw. Eine Installation, die ich so für meinen Haupt-PC nicht machen würde. Eine Kleinigkeit ist mir noch aufgefallen. Der Calamares Installer der benutzt wird, hat bei mir keine Sonderzeichen akzeptiert. Ich hoffe das wird bis zum Release gefixt. Hier noch kurz das Testsystem [image: 1705003417706-screenshot_20240111_210201.png] Ich nutze ausschließlich Wayland, das läuft einfach wesentlich besser. Aber, ich weiß da draußen gibt es viele die das nicht mögen. Das schöne an Linux - ihr habt die freie Wahl. Was war mir negativ aufgefallen? Installer - keine automatische Standortbestimmung Installer - nimmt keine Sonderzeichen für das PW an Login Window - nach Eingabe PW wird die Taste RETURN nicht akzeptiert. Muss ich mit der Maus anklicken. Skalierung auf meinem Monitor nicht optimal - Schrift unscharf Was ist mir positiv aufgefallen? Ich nutze einen 4K Monitor zum Testen. Die Skalierung war automatisch auf 175%. Eine fast perfekte Wahl, wenn da nicht die unscharfe Schrift wäre. Ich habe das auf 150% gestellt, danach war es deutlich besser. Updates kann man sich über das grafische Frontend holen Standby-Modus ging Und einen nervigen FF Bug konnte ich nicht nachstellen. Auf meinem aktuellen System, KDE Plasma 5, flackert der Bildschirm gelegentlich, wenn ich in der Taskleiste durch die geöffneten FF Fenster scrolle. Bei Plasma 6 konnte ich das bis jetzt noch nicht feststellen. Fazit Sieht gut aus, der Release von KDE Plasma 6 wird gut. Ich freu mich drauf. Und diesen komischen Updatevorgang den KDE Neon da benutzt, diesen M$ Style, den könnt ihr direkt wieder in die Mülltonne kloppen. Das möchte ich bei Linux nicht sehen. [image: 1705005840070-screenshot_20240111_214255-resized.png]
  • NodeBB - v3.6.0

    NodeBB nodebb linux
    1
    0 Stimmen
    1 Beiträge
    112 Aufrufe
    Niemand hat geantwortet
  • Debian Installer Bookworm RC3 released

    Linux debian linux
    2
    0 Stimmen
    2 Beiträge
    159 Aufrufe
    FrankMF
    Und da sind wir schon bei RC4 https://lists.debian.org/debian-devel-announce/2023/05/msg00003.html
  • Debian Bookworm 12 - Btrfs Installation

    Linux debian bookworm linux
    3
    1
    0 Stimmen
    3 Beiträge
    2k Aufrufe
    FrankMF
    Das mit den Namen der btrfs Subvolumes ist bekannt bei Timeshift. Im Readme steht dazu folgendes. BTRFS volumes BTRFS volumes must have an Ubuntu-type layout with @ and @home subvolumes. Other layouts are not supported. Systems having the @ subvolume and having /home on a non-BTRFS partition are also supported. Text file busy / btrfs returned an error: 256 / Failed to create snapshot can occur if you have a Linux swapfile mounted within the @ or @home subvolumes which prevents snapshot from succeeding. Relocate the swapfile out of @ or *@home, for example into it's own subvolume like @swap.
  • Hetzner Cloud - Server läßt sich nicht verschieben!

    Linux hetzner linux
    1
    0 Stimmen
    1 Beiträge
    385 Aufrufe
    Niemand hat geantwortet
  • Ubiquiti ER-X - Installation

    Verschoben OpenWRT & Ubiquiti ER-X openwrt linux er-x
    1
    1
    0 Stimmen
    1 Beiträge
    615 Aufrufe
    Niemand hat geantwortet
  • Kopia - Mit Snapshots arbeiten

    Kopia linux kopi
    2
    4
    0 Stimmen
    2 Beiträge
    420 Aufrufe
    FrankMF
    Solltet Ihr mal snaps mit dem Status incomplete haben und möchtet diese loswerden :~$ kopia snap ls -i USER@HOST:/home/frank 2020-09-10 16:31:45 CEST k89770cab1061e00ada49efc41075ed34 incomplete:canceled 728.8 MB drwxr-xr-x files:8891 dirs:3033 (incomplete) 2020-09-10 16:40:05 CEST k27f028b63299983167cb0b4a0c85df80 incomplete:canceled 153.8 MB drwxr-xr-x files:1052 dirs:324 (incomplete) So was passiert z.B. wenn die Internetleitung rumzickt. Jarek meint, das wäre nicht schlimm, beim nächsten Snapshot wird das gefixt und die Daten genutzt, die schon verarbeitet wurden.
  • IPTables Logging

    Linux linux iptables
    1
    0 Stimmen
    1 Beiträge
    313 Aufrufe
    Niemand hat geantwortet