Direkt zum Hauptinhalt

ProxMox

Inhaltsverzeichnis

Die Dokumentation für "Proxmox Produktiv mit ZFS betreiben" basiert auf einem kostenpflichtigen Kurs und soll dessen Inhalte wiedergeben, kann aber nicht die Betreuung und Beantwortung von Fragen, wie sie der Besuch des Kurses bietet, ersetzen. Es soll das Wissen von den hauptberuflichen Sysops Admins an Interessierte weitergegeben werden, die es danach auf den von Ihnen betreuten Systemen umsetzen können.

https://cloudistboese.de - Das Schulungsportal von sysops.tv

Proxmox:

  • Gemischtes System für Virtualisierung und ZFS Storage

  • Umfangreiche Virtualisierung und Containering Lösung

  • Moderner Unterbau mit aktuellem Debian Linux

  • Reichhaltige Funktionen die durch eigene Kommandozeilenlösungen erweitert werden

  • Kaum bis keine Funktionen für ZFS

  • Kernfunktionen

  • KVM Virtualisierung und LXC Containering

  • ZFS Storagesystem für Software RAID und rudimentäre Snapshot- und Replikationslösung

  • Optional: NFS-Kernel Server

  • Optional: iSCSI Target

  • Optional: erweitertes ZFS-Management mit Sysops Hauslösungen

    • Indikation für Einsatz
  • Kleinere Anzahl von PVE Systemen mit Aufnahme von Datenträgern

  • Hoher Anspruch an Snapshotverwaltung

  • Leichte Replikation der Daten auf zweites System und eventuelle weitere Ziele

  • Applikationsbasierte Datensicherung

  • Eigenes Monitoring und Reporting bevorzugt - Zentrales Monitoring wie Checkmk

  • Einfacheres Deployment und Wiederherstellung

  • Bei Linux kommt alles auf den Kernel (ZFS und KVM)

Chriz rät von der Nutzung als iSCSI Server ab

Proxmox Workshop 20230926 und 20230928

26.09.2023

Linux Kommandos

  • lsb_release -a # Debian Version
  • cat /etc/debian_version # Debian Version
  • systemctl reboot # reboot
  • reboot# reboot
  • init 6 # reboot
  • sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list # Anpasung von Textfiles mittels sed

Proxmox Installation

Um Proxmox mit ZFS nutzen zu können, müssen die Platten direkt an Proxmox gegeben werden. Es sollte kein RAID Controller mit RAID 0 genutzt werden, da dies früher oder später zu Problemen führen wird. Damit auch eine Update von Promox 7.x auf 8.x gezeigt werden kann, wird mit der Installation einer Proxmox Version 7.x begonnen. Das Postinstall Script aus dem Bashclub wird auch installiert, um auch alle benötigten Tools für die tägliche Arbeit und im Problemfall im Zugriff zu haben.

  • Kein RAID Controller
  • Platten direkt an Proxmox geben
  • ISO Installation mit Version 7.x - wegen Update auf 8.x durchführen zu können
    • Install Proxmox
    • Target Harddisk sda / sda —> ext4 mit LVM - daher auf options (ALT o)
  • ZFS RAID 1 oder ZFS RAID 10
  • Festplatten müssen gelesen werden
  • Advanced Option - ZFS Optionen
  • Passwort muss sich in der HTML Console tippen lassen - Thomas Krenn Server sind da
    zickick
  • Proxmox Boot-Tool kann hilfreich sein
  • https://<ip>:8006
    • Single PAM - ssh login in
    • Proxmox VE - Weboberfläche Cluster
  • /etc/ssh/sshd_config ◦PermitRootLogin without-password
  • TOTP (... one Time Password)
  • Postinstall aus bashclub - github
    • No Subscription auswählen
    • 96 hours wegen Weihnachten und Ostern
    • Backup /etc zfs dataset rpool/pveconf - Configuration liegt in einer Datenbank ◦...

Update nach Proxmox 8.x

Proxmox Update 7 to 8

Das Pre-Upgrade Check Script pve7to8 sollte ausgeführt werden, um mögliche Probleme vor dem Upgrade erkennen zu können. Erstmal ohne Parameter und anschließend mit Parameter (--full: alle Checks). In der Zusammenstellung des Updates wurde auch die Zeile für no subscription eingefügt. Das Unterverzeichnis source.list.d von /etc/apt sollte gecheckt werden, dass alle Dateien auf "bookworm" umgestellt worden sind, damit das Debian Update wieder einwandfrei funktioniert. Nach dem Update von Debian und dem reboot, ist ein Refresh des Brwoser erforderlich, damit die neue Version angezeigt wird.

Eintrag no subscription in /etc/apt/source.list

  • pve7to8

  • ve7to8 -- full

  • Proxmox Update nach Anleitung von ProxMox - Subscription bzw. Nosubsription beachten

  • Nach Kernel Update - reboot einplanen

  • apt update
    apt dist-upgrade
    pveversion
    #
    sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
    # Enterprise
    echo "deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise" > /etc/apt/sources.list.d/pve-enterprise.list
    # No subscription - siehe Link
    echo "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list
    sed -i -e 's/bullseye/bookworm/g' /etc/apt/sources.list.d/pve-install-repo.list 
    # Debian update
    apt update
    apt dist-upgrade
    systemctl reboot
    
    

proxmox-boot-tool / ZFS Feature Upgrade / Trimming einschalten

Mit dem promox-boot-tool könnten Platten nach einen Hardwaretausch wieder bootfähig gemacht werden. Heute sollte nach Möglichkeit uefi Boot eingesetzt werden und nicht mehr legacy boot, damit werden die Boot Platten automatisch erkannt und müssen nicht einzeln durch probiert werden, wie bei legacy boot. Autotrim sollte auf dem ZFS Dataset eingeschaltet sein, damit freie Blöcke wieder im Dateisystem verfügbar gemacht werden.

  •     dmesg -w # oder 
        dmesg -Tw # - Hardware Tausch 
        ProxMox-boot-tool 
        proxmox-boot-tool status 
        zpool upgrade 
        zpool upgrade -a # führt das Upgrade durch 
        # ZFS trim einschalten 
        zpool set autotrim=on rpool # Freigabe leerer Blöcke ◦zpool trim rpool
        zpool status 1 
    
    

Einige wichtige Ordner vom Proxmox:

  • Template Ordner /var/lib/vz
  • ISO Ablage Ordner /var/lib/vz/template/iso
    ◦z.B. virtio-win.iso
  • Cache /var/lib/vz/cache/ z.B. *.tar.gz Proxmox Mailgateway

PVE boot nicht mehr

Wenn der Proxmox nicht mehr bootet, werden die folgende Schritte durchgeführt, um ihn wieder herzustellen zu können. Die erforderlichen ZFS snapshots werden durch dendie "Tools" des Postinstaller erzeugt. Beim PVE Ordner (/etc/pve) handelt es sich um eine Datenbank (/dev/fuse 128M 20K 128M 1% /etc/pve), die ohne den Postinstaller nicht gesichert würdewürden (rpool/pveconf 884G 128K 884G 1% /rpool/pveconf).

  • CD bzw. ISO booten - ...Debug ...

  • exit - damit nicht der Installer bootet
    zpool status zpool import
    zpool import rpool zpool import -fa # a für all
    zpool import -f rpool zpool status
    zpool list
    zfs list -t snapshot
    zfs list -t snapshot | grep pve-1
    zfs rollback -r rpool/ROOT/pve-1@zfs-auto-snap.hourly\_2023-09-26-1251 # entsprechender snapshot - boot und Proxmox geht wieder ```
    
  • data zurück rollen

zfs rollback -r rpool/data@... (?) #  data/vm... zurück rollen

Verschlüsseltes ZFS

  • Verschlüsseltes ZFS ◦zfs-load-key

    • Replication raw - Chriz Software unterstützt das ...

    PVE Grafik

      local
      local-ZFS

      VM auf RAID-Z 8k versus 16k

      • ZFS create rz\_repel/vmtest ZFS create V 10G rz\_repl/vmtest/disk8k # Keine RAID5 für VM‘s - langsam wegen 8k ◦RAID5 min. 16K einstellen ```
        
        
        

      Local-ZFS Einstellung auf min. 16K einstellen ◦Proxmox Standard volblocksize=8k

      Siehe awo.de Tabelle - Artikel ZFS RAID

      VirtIO Treiber für Windows

      Auf ProxMoxProxmox Seite nach stable suchen

        Link kopieren
          Stable Download (Fedora) - Link von Proxmox Seite In ProxMox GUI - Download URL eintragen

          Filename: VirtIO-win.iso

          ISO Ablage Ordner **/var/lib/vz/**template/iso

          ProxMox Virtual Treiber - für Windows iso

          Create VM

          • System

            • Maschine q35
            • BIOS: OVMF (UEFI)
            • Emu Agent
            • EFI Storage: local-zfs

          Disks

          • Bus/Device: SCSI # VirtIO Block ist obsolet !!!
          • SCSI - VirtIO SCSI Single - SCSI steht für SCSI Controller auf der vorseite - kann ein
            Prozessorkern pro Festplatte
          • Discard
          • SSD emulation
          • Cache: - Default (no cache) - keine Cache einschalten !!!
            ‣ CPU

          CPU

            Type: Host

            Network

            • Bridge: vmbr0
            • Model VirtIO (paravirtualized)

            GUI - vm - Hardware - CD/DVD

            • Zweites CD Laufwerk VirtIO Treiber iso ◦GUI - vm - Hardware - Maschine

            q35 Version 5.2 - weniger Probleme als mit 8.0 wegen deutschen Treibern - ist für US optimiert ... - Probleme mit Netzwerkkarten

            EFI hat feste Bildschirmauflösung - kann nur in der EFI der VM eingestellt werden (EFI BIOS) - Im BIOS ESC drücken

            Windows Installer

            Treiber - Virtualio SCSI laden - vioscsi - win10 - amd64

            vm-<id vm>-disk-0 EFI BIOS - speichert z.B. Bildschirmauflösung - z.B. zd0

              vm<id-vm>-disk-1 Windows 10 - z.B. zd16

                Windows partitioniert die „disk-1“ in 3 Partitionen - während der Installation p1: EFI p2: Microsoft reserved p3: Microsoft basic data

                Windows ohne Netzwerk = keine dummen Tools

                Windows ohne Passwort = keine Fragen

                Wichtig für den Start der VM

                Pool muss online

                Pool unter 80 %

                Definition der Datenstorages unter cat /etc/pve/storage.cfg ◦PVE Server 101.conf - unter cat /etc/pve/qemu-server/101.conf ◦Virtual CD - fehlende Treiber - 1 Controller pro Festplatte

                  Virtio-win-guest-tools - evtl. Erweiterung exe sichtbar - installierten - installiert alles - liegt im Hauptverzeichnis der CD/DVD - am Ende auch die Guest-Tools

                  Reale Memory Anzeige, CPU Usage und IP Adressen ◦Deinstallation der Apps
                  Powershell

                  Get-appxPackage | Remove-appxPackage # man verliert Taschenrechner - alle App 

                  werden entfernt - auch der Storage wird entfernt ‣ Nach Feature Update wieder alles da

                    Festplatte vergrößern

                    • Resize 16 GB - bedeutetet +16 GB

                    Auf PVE

                    cd /dev/zvol/rpool/data 
                    ls -alter
                    
                    

                      Wiederherstellungspartiions an das Ende verschieben oder löschen

                      /dev/zvol/...

                            cfdisk # - Partition löschen 
                        
                        

                        Partition in Windows Erweitern

                          Unter Linux VM ausschalten, resize geht nicht immer Fehlerfrei Datenträger neue Größe

                          Explorer noch alte Größe

                              zfs history 
                              cd /dev/zvol/rpool/data 
                              ls -althr 
                          
                          

                          SSD Emulation / Discard

                          Defragemtieren

                          Unter Einstellungen ändern: Auf einmal täglich einstellen

                          Windows Swap optimieren - powershell

                                attrib 
                                powercfg -h off # evtl. Darf es der User nicht - powershell als administrator starten 
                                zfscreate-o com.sun:auto-snapshot=false rpool/swap # keine  autosnapshots!!! 
                            
                            

                            PVE rpool/swap in der GUI - Add ZFS

                            ID: rpool-swap

                            ZFS Pool: rpool/swap

                            Content: Disk Image

                            Thin provision Haken setzen !

                            Block Size: 16K

                            Add Hard Disk: ◦Disk Size: 8 G

                              Storage: rpool-swap
                              SSD emulation
                              Discard
                              Backup haken ? Herausnehmen ? - Backup: ja - Replication: nein

                              Im PVE add ZFS

                              ID: rpool-swap

                              ZFS Pool: rpool/swap ◦Content: Disk Image ◦Thin provision: Haken ◦Block Size: 16K

                                PVE Add Hard Disk

                                  Bus/Device: SCSI
                                  Storage: rpool-swap
                                  Disk size (GiB): 8
                                  SSD emulation: Haken
                                  Discard: Haken
                                  Backup: Haken - auf jedenfall bei Linux - Windows braucht die Partition nicht, bei
                                  Replication: nein, Backup: ja

                                  Nach neuer Hardware suchen - Evtl. Bug - Hotswap - bei SCSI Controller VirtIO SCSI
                                  würde er ihn direkt erkennen

                                    Neuer Speichercontroller gefunden

                                    Neues Laufwerk a: oder b: # Niemand braucht a: oder b: mehr

                                    Auslagerungsdatei auf a: ändern und c: herausnehmen

                                    Checkliste Platz

                                    Linux in crontab /sbin/fstrim -av - für Linux VM

                                    crontab -e

                                      0 0 * * * /sbin/fstrim -a
                                      ◦fstrim -av # muss eine Ausgabe bringen - sonst vm falsch konfiguriert \
                                        - VM Platten auf SSD und Discard umstellen
                                      
                                      

                                        Wenn 8k und RAID 5 —> neuer datastore 16k und move disk
                                        Wenn die in vm —> Treiber rein, runter fahren deatach, attach mit ssd / discard >

                                        Optimierungen

                                          Page file wie oben erklärt
                                          Dann daily optimieren, Platz wird nach spätestens nach 3 Monaten frei, optional snapshot

                                          löschen

                                          Optional vacuum auf Datenbanken

                                          28.09.2023

                                          Workshop 2023-09-28

                                          • Platten replacement

                                          Artikel von ProMox - ist nicht ganz korrekt: https://pve.proxmox.com/wiki/ZFS_on_Linux

                                          zpool set autoexpand=on rpool # Erweiterung des Pools, wenn alle Platten getauscht ◦sgdisk /dev/sdb -R /dev/sda #

                                          Partitionstabelle kopieren

                                          cfdisk /dev/sda # Partition vergrößern
                                          
                                          sgdisk -G /dev/sda # EFI: neuer Fingerabdruck, damit EFI zu recht kommt 
                                          proxmox-boot-tool format /dev/sda2 # format die Bootpartition (Partition 2) - Windows
                                          
                                          

                                          Dateisystem (vat)

                                          proxmox-boot-tool init /dev/sda2
                                          proxmox-bool-tool status
                                          proxmox-boot-tool clean # wirft Platten heraus, \ die er nicht mehr kennt
                                          update-initramfs -u # alte Variante - wegen aktuellen \
                                            Bug - nur eine Platte bootet über status
                                          apt install systems-boot # systemd-boot fehlt nach Update von 7.x auf 8.x
                                          zpool replace rpool ata-INTEL-...-part3 ata-ST2000...-part3 \
                                            # „alte Platte“ „neue Platte“
                                          zpool status
                                          zpool status 1
                                          
                                          

                                            Im Einspielvorgang resilver Vorgang

                                            • ZFS interessiert das nicht - Hardware RAID böse !!!
                                            • Nach dem Reboot geht das Einspiegeln weiter ...
                                            Zweite HDD in freien Slot stecken

                                            Nach dem Booten können die Festplatten einen anderen Buchstaben bekommen haben, so

                                            wiesowie er sie erkannt hat

                                            sgdisk /dev/sdb -R /dev/sdd
                                            sgdisk -G /dev/sdd
                                            zpool status
                                            proxmox-boot-tool format /dev/sdd2
                                            proxmox-boot-tool init /dev/sdd2
                                            proxmox-boot-tool status
                                            zpool status
                                            
                                            

                                              Cockpit ZFS nur zum schauen - kein two Factor !! - aus Postinstall Proxmox - Achtung neuer

                                                wget https://raw.githubusercontent.com/bashclub/proxmox-zfs-postinstall/main/install-cockpit-zfs-manager bash install-cockpit-zfs-manager

                                                ‣ https://<ip>:9090

                                                root user kann sich nicht per Passwort einloggen
                                                ◦Temporär in der /etc/ssh/ssd_conf ändern # keine EmpfehlungKey muss irgendwo hinterlegt werden # nur zum lernen !!!

                                                z.B. für das zum Zurückspielen einer VM - VM muss vorher im Proxmox gestoppt werden
                                                zpool replace ... # löscht Platte !!! zpool attach rpool ata-... # neue Platte erst hinzufügen zpool detach ... # Schublade - Backup zpool attach rpool ata-INTEL-SSD..-part3 ata-ST2000...-part3 # hängt die HDD hinter die SSD ◦zpool status # 3 Platten im mirror-0 !!!

                                                SSD HDD Hard herausziehen und anschließend detach der Platte

                                                
                                                
                                                zpool status
                                                zpool detach rpool ata-INTEL-SDD...-part3
                                                proxmox-boot-tool status 
                                                proxmox-boot-tool clean
                                                proxmox-boot-tool status
                                                zpool status # rpool hat jetzt 1.82 TB - Pool vergrößert
                                                arcstat
                                                vi /etc/modprobe.d/zfs.conf
                                                proxmox-boot-tool refresh # in den Images wird der Cache auf den neuen Wert gesetzt, ZFS
                                                
                                                

                                                muss das vor wissen bevor es boot, zfs.conf liegt auf ZFS • Windows kaputt machen - Trojaner

                                                ◦Netwerkkarte disablen durch Trojaner
                                                ◦VM herunterfahren
                                                ◦Entwicklung der Größe der snapshot‘s - als Indikator ◦Rollback snapshot über Cockpit oder über command Line

                                                • Cache

                                                zpool add -n rpool cache ata-intense..
                                                zpool add -nf rpool cache ata-intense.. # wenn schon Daten auf der Platte ◦zpool add -f rpool cache ata-intense..
                                                zpool iostat -v 3
                                                zpool iostat -v 1 # 1 sec
                                                
                                                

                                                • Proxmox Cluster
                                                ◦GUI - Cluster - create cluster ◦pvecm create „clustername“ ◦GUI - Cluster - „add Cluster“ ◦pvecm add clusterserver1 ◦Kein Cluster mehr

                                                https://pve.proxmox.com/wiki/Cluster_Manager#_remove_a_cluster_node

                                                Goto: First, stop the corosync and pve-cluster services on the node:◦

                                                cd /etc/pve
                                                
                                                

                                                ‣ storage.cfg

                                                • ‣ qemu-server/*.conf

                                                • ‣ lxc/*.conf

                                                • ‣ nodes/... # Ordner mit den Cluster Member ``` top  ps aux  ps aux | grep qm # Herstellung aller Maschinen anhand dieser Ausgabe 

                                                • ‣ Login in Cluster funktioniert nach Fehlschlag nicht mehr

                                                service pveproxy restart
                                                
                                                

                                                ◦Neue Zertifikat - zwei Faktor Authenfication der lokal User liegt heraus

                                                cd /rpool/pveconf 
                                                zfs list -t snapshot rpool/ROOT/pve-1 
                                                
                                                
                                                zfs rollback -r rpool/ROOT/pve-1@zfs-auto-snap_hourly-2023-09-28-1017 # panic Variante und Stromkabel nach 2 s
                                                
                                                
                                                  1. besser von cd booten, rollback wie oben
                                                  1. Ordner .zfs unter /rpool/pveconf
                                                •     cd snapshot # dieser Ordner nur in dataset roots 
                                                      # Snapshot order auswählen 
                                                      ◦ cd zfs-auto-snap_hourly-2023-09-28-0717
                                                      ◦ cd etc/pve/nodes/pvews
                                                      ◦ cd lxc
                                                      ◦ ls 
                                                      ◦ cp 100.conf /etc/pve/lxc
                                                      ◦ cd ..
                                                      ◦ cd qemu-server
                                                      ◦ cp 101.conf /etc/pve/qemu-server
                                                      ◦ # evtl. Alternativ cp 101.conf /etc/pve/nodes/pvews/qemu-server
                                                      ◦ vi /etc/pve/nodes/pvews/qemu-server/101.conf # Anpassung von Namen 
                                                  
                                                  

                                                • Boot Partitionen löschen

                                                ◦Über dd

                                                dd if=/dev/zero of=/dev/sda2 bs=1M count=511 
                                                dd if=/dev/zero of=/dev/sdd2 bs=1M count=511 
                                                proxmox-boot-tool status 
                                                
                                                
                                                • Boot über CD/DVD - Advanced - debug mode console

                                                ‣ Type exit - damit Installer nicht startet
                                                https://pve.proxmox.com/wiki/ZFS:_Switch_Legacy-Boot_to_Proxmox_Boot_Tool

                                                • Repairing a System Stuck in the GRUB Rescue Shell
                                                ◦Repairing a System Stuck in the GRUB Rescue Shell
                                                ◦If you end up with a system stuck in the grub rescue> shell, the following steps

                                                should make it bootable again:
                                                ◦Boot using a Proxmox VE version 6.4 or newer ISO
                                                ◦Select Install Proxmox VE (Debug Mode)
                                                ◦Exit the first debug shell by typing Ctrl + D or exit
                                                ◦The second debug shell contains all the necessary binaries for the following steps ◦Import the root pool (usually named rpool) with an alternative mountpoint of /mnt:

                                                zpool import -f -R /mnt rpool
                                                zfs list # Chris im Video
                                                
                                                
                                                

                                                ◦Find the partition to use for proxmox-boot-tool, following the instructions from

                                                Finding potential ESPs
                                                ◦Bind-mount all virtual filesystems needed for running proxmox-boot-tool: ◦

                                                mount -o rbind /proc /mnt/procmount -o rbind /sys /mnt/sysmount -o rbind /dev /mnt/devmount -o rbind /run /mnt/run ◦ls /mnt # Video Chriz
                                                ◦change root into /mnt
                                                chroot /mnt /bin/bash

                                                • ‣ cat /etc/network/interfaces # Video Chriz
                                                •     ‣  proxmox-boot-tool status 
                                                      ‣  lsblk 
                                                      ‣  proxmox-boot-tool format /dev/sdb2 
                                                      ‣  proxmox-boot-tool format /dev/sdc2 
                                                      ‣  proxmox-boot-tool init /dev/sdb2 
                                                      ‣  proxmox-boot-tool init /dev/sdc2 
                                                      ‣  proxmox-boot-tool status 
                                                      ‣  proxmox-boot-tool clean 
                                                      ‣  zpool export rpool # hat im Video gefehlt, daher nach reboot zpool import -f rpool 
                                                  
                                                  
                                                • ‣ <CTRL> <ALT> <ENF> # reboot auslösen
                                                • ‣ zpool import -f rpool # letzter Besitzer war CD ‣ exit # erneuter reboot ‣ zpool status
                                                • ‣ Wichtige Dateien:
                                                  • /etc/network/interfaces • storage.cfg
                                                  • qemu-server/*.conf
                                                  • lxc/*.conf

                                                • Boot Partitionen löschen ◦cfdisk /dev/sdb

                                                ‣ Partition 1 in dPartition 2 löschen ◦cfdisk /dev/sdc

                                                ‣ Partition 1 in dPartition 2 löschen ◦reboot

                                                ◦Proxmox neu installieren auf cache SSD ohne zfs ‣ Boot von CD

                                                ‣ Install Proxmox ohne ZFS auf SSD

                                                • Würde mit ZFS installiert, hätten wir wieder ein rpool und müssten den original Pool rpool in z.B. rpool1 umbenennen und local-zfs anpassen !!!!
                                                • Profi Tipp: Alle anderen Platten ziehen, damit auf keiner falschen Installiert wird
                                                • Installation mit ext4 mit lvm
                                                • Neues Zertifikat und Passwort neu
                                                • ssh meckert wegen known_hosts # Neu Installation
                                                • zfs list # zeigt leere Liste
                                                •     zpool import -fa # alle importieren 
                                                      zfs list # rpool ist wieder da 
                                                      cd /rpool/pveconf 
                                                      cd etc 
                                                      cd pve 
                                                      ls 
                                                      cp storage.cfg /etc/pve 
                                                      cd qemu-server 
                                                      cp 101.conf /etc/pve/qemu-server # Produktiv System cp *.conf /etc/pve/qemu- 
                                                      server 
                                                      cd .. 
                                                      cd lxc 
                                                      cp 100.conf /etc/pve/lxc # Produktiv System cp *.conf /etc/pve/lxc 
                                                  
                                                  
                                                • ISO‘s als DVD heraus werfen, da vermutlich nicht gesichert
                                                • ‣ zpool remove rpool add # cache ssd entfernen # atach und detach nur mirror - alles andere wird removed
                                                • ‣ Am Abend wieder heile machen
                                                • Booten von CD/DVD
                                                • Advanced Mode - Debug mode
                                                  ◦Partitionstabelle wiederherstellen

                                                ‣ Anderen Proxmox schauen

                                                • https://pve.proxmox.com/wiki/ZFS:_Switch_Legacy- Boot_to_Proxmox_Boot_Tool

                                                ◦Repairing a System Stuck in the GRUB Rescue Shel ◦

                                                zpool import -f -R /mnt rpool
                                                ◦zfs list # Chris im Video
                                                
                                                

                                                ◦Find the partition to use for proxmox-boot-tool, following the

                                                instructions from Finding potential ESPs
                                                ◦Bind-mount all virtual filesystems needed for running proxmox-

                                                boot-tool:

                                                mount -o rbind /proc /mnt/proc
                                                mount -o rbind /sys /mnt/sys
                                                mount -o rbind /dev /mnt/dev
                                                mount -o rbind /run /mnt/run
                                                chroot /mnt /bin/bash
                                                # Partitionstabelle eines anderen ProxMox Systems anschauen 
                                                sgdisk /dev/sdd -R /dev/sdb # muss resized werden
                                                cfdisk /dev/sdb
                                                
                                                

                                                ◦ Partition 3 wieder vergrößern # Werte überprüfen mit Foto falls vorhanden

                                                sgdisk /dev/sdb -R /dev/sdc
                                                sgdisk -G /dev/sdb
                                                sgdisk -G /dev/sdc
                                                
                                                

                                                ◦Änderungen haben nicht gegriffen - reboot erforderlich # alternativ

                                                parted - partedprobe bekommt das im laufenden Betrieb

                                                ◦Reboot
                                                ◦Evtl. mit proxmox-boot-tool Partitionen wieder herstellen, zuvor

                                                muss die ProxMox Umgebung über die chroot Umgebung gebaut werden ...

                                                Reboot
                                                zpool import -fa
                                                exit # reboot vom ProxMox 
                                                zpool status ◦proxmox-boot-tool status
                                                
                                                

                                                ◦3. Variante für Arbeiten
                                                ‣ Externe SSD - True NAS installieren - geht aber nur für VM‘s - VM‘s per SCSI freigeben

                                                • Backup ProxMox Datenbank
                                                cat /etc/cron.d > /pve-conf-backup

                                                rsync. ... /etc /rpool/pveconf # alle 15 min - ab 3 Minute • Import Daten

                                                ◦vmdk vhdx raw qcow2 > mounten vom original (vm aus!)

                                                • /mnt/pve/nfsstore oder smbshare
                                                • ◦zvol / lvm / usb / hdd /ssd
                                                  ◦qm importdisk 100 /mnt/hypervfreigabe/dc.vhdx local-zfs (via samba)
                                                  ◦qm importdisk 100 /mnt/pve/nfsstore/vmfs/id/dc/dc.vmdk local-zfs # (via NFS oder SSHFS)
                                                • ◦Echte Systeme

                                                ◦Clonezilla
                                                https://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE

                                                • Clonezilla Live CDs
                                                ◦Disks erscheinen erst mal unused - mit Doppelclick hinzufügen und booten

                                                • Backup und Monitoring

                                                zfs list # Ziel Backup Disk - Pool Backup
                                                zfs create backup/repl -o com.sun:auto-snapshot=false 
                                                zfs set com.sun:auto-snapshot=false backup 
                                                Bash-club-zfs-push-pull # auf Ziel
                                                
                                                
                                                • git clone https://github.com/bashclub/bashclub-zfs-push-pull.git cd bashclub-zfs-push-pull chmod +x 02pull bashclub-zfs cp bashclub-zfs /usr/bin vi 02pull # Anpassen - In for Schleife ein echo zum Testen bashclub-zfs # Parameter I und R - alte Snapshot und Zwischen snapshots mitnehmen # Prinzipiell pull !!! - Quelle kommt nicht auf das Ziel, sondern nur Ziel kommt auf Quelle cp 02pull /etc/cron.hourly
                                                • ‣ Monitoring
                                                wget -O /usr/local/bin/checkzfs https://raw.githubusercontent.com/bashclub/check-zfs-replication/main/checkzfs.py  
                                                chmod +x /usr/local/bin/checkzfs 
                                                checkzfs --sourceonly 
                                                checkzfs --filter rpool/data/ --replicafilter backup/repl --threshold 75,90 
                                                checkzfs --filter rpool/data/ --replicafilter backup/repl --threshold 75,90 --columns 
                                                +message 
                                                
                                                
                                                • wget -O /usr/local/bin/checkzfs https://raw.githubusercontent.com/bashclub/check-zfs-replication/main/checkzfs.py
                                                  • Keep: Hours 96, dayli 14
                                                  • ProxMox GUI
                                                    ◦Storage - Add ZFS
                                                  •     cd /etc/pve/qemu-server 
                                                        cp 101.conf 9101.conf 
                                                        vi 9101.conf 
                                                    
                                                    
                                                  • ◦:%s/local-zfs/backup-repl/g ◦Swap entfernen
                                                    ◦DVD Laufwerke entfernen ◦Name am Anfang repl- anfügen
                                                • GUI der VM 9101
                                                  ◦Netzwerkkarte deaktivieren # Befehl kann man nachher in der conf nachschauen ◦Autostart disablen
                                                • VM 9101 starten # aber Replikationszeit beachten - cron.hourly, ... beachten
                                                • LXC Container kann mittlerweile die Netzwerkkarte deaktivieren - alternativ in anderen
                                                  vswitch
                                                •     checkzfs --filter rpool/data/ --replicafilter backup/repl --threshold 75,90 --columns 
                                                      +message --output checkmk
                                                        # Datei generieren und auf anderen Server kopieren - über scp 
                                                      zfs mount -a 
                                                      ls /backup/repl/subvol-100-disk-0/etc/pmg 
                                                      mkdir /mnt/restore 
                                                      mount /dev/zvol/backup/repl/vm-101-disk-1-part3 /mnt/restore 
                                                      ls /mnt/restore # Damit kann man Daten aus dem Windows zurückspielen 
                                                      umount /mnt/restore 
                                                      zfs create backup/klon -o com.sun:auto-snapshot=false 
                                                      zfs list -t snapshot backup/repl/vm-101-disk-1 
                                                      zfs clone backup/repl/vm-101-disk1@bashclub-zfs_2023-09-28_16:21:30 backup/klon/vm-101-disk-1 
                                                      mount /dev/zvol/backup/klon/vm-101-disk-1-part3 /mnt/restore 
                                                      ls /mnt/restore 
                                                      vi /etc/pve/qemu-server/9101.conf # Anpassung vom Klon 
                                                  
                                                  
                                                • VM aus Klon booten und sich anschauen ...
                                                •     umount /mnt/restore 
                                                      zfs get guid 
                                                      zfs get guid | grep bashclub-zfs_2023-09-28_16:46:50 
                                                      zfs get creation rpool/data/subvol-100-disk-0@bashclub-zfs_2023-09-28_16:46:50 
                                                  
                                                  
                                                • zfs replication für arme
                                                zfs snapshot rpool/data/vm-100-disk-0@snap1 # snapshot auslösen - evtl. nicht komplettes Command
                                                
                                                

                                                zfs send rpool/data/vm-100-disk-0@snap1 | zfs recovery -dvF backup/repl # local 
                                                zfs send rpool/data/vm-100-disk-0@snap1 | ssh rot@zielip zfs recovery -dvF
                                                
                                                

                                                backup/repl # push

                                                ssh root@sourceip zfs send rpool/data/vm-100-disk-0@snap1 | zfs recovery -dvF backup/repl # pull
                                                
                                                

                                                • checkzfs mit Mail - dafür muss Mail konfiguriert sein

                                                checkzfs --filter rpool/data/ --replicafilter backup/repl \
                                                --threshold 75,90 --columns+message --output mail