Proxmox PBS ZFS best practice

ZFS Pool erstellen mit special device für Metadaten

zpool create  -o ashift=12  backupstorage raidz1  \
  /dev/disk/by-id/ata-ST24000NM000C-3WD103_ZXA0JCB5 \
  /dev/disk/by-id/ata-ST24000NM000C-3WD103_ZXA0EPHT \
  /dev/disk/by-id/ata-ST24000NM000C-3WD103_ZXA0K5GS \
  /dev/disk/by-id/ata-ST24000NM000C-3WD103_ZXA0MQM7 \
  special mirror /dev/disk/by-id/nvme-eui.01000000000000008ce38ee306063c4d /dev/disk/by-id/nvme-eui.01000000000000008ce38ee30a536b19

zpool add backupstorage log mirror /dev/disk/by-id/xxx /dev/disk/by-id/xxx
zpool add backupstorage cache /dev/disk/by-id/xxx

zfs set mountpoint=/mnt/pbs backupstorage
zfs set recordsize=1M backupstorage
zfs set compression=zstd backupstorage
zfs set atime=off backupstorage
zfs set xattr=sa backupstorage
zfs set acltype=posixacl backupstorage

zfs set recordsize=128K backupstorage
zfs set special_small_blocks=128K backupstorage # 32K alternativ

Benchmark

Sequentielle Backup-Performance (fio write, 1M)

fio --rw=write --bs=1M --numjobs=1 --iodepth=4
StorageDurchsatzLatenz (avg)
1× HDD-Mirror250–300 MB/s4–6 ms
2× HDD-Mirror450–550 MB/s5–8 ms
LimitierendHDD-Sequential

Sequentielle Restore-Performance (fio read, 1M)

fio --rw=read --bs=1M --numjobs=1 --iodepth=4
StorageDurchsatz
1× HDD-Mirror280–320 MB/s
2× HDD-Mirror500–650 MB/s
Mit warmem ARC+10–20 %

Verify-ähnlicher Read (fio read, 128K, 4 Jobs)

fio --rw=read --bs=128K --numjobs=4 --iodepth=2
SzenarioDurchsatzIOPS
Ohne Special Device80–150 MB/s600–1.200
Mit NVMe Special 250–400 MB/s2.000–3.500

Proxmox VE Helper-Scripts

Die Webseite „Proxmox VE Helper-Scripts“ ist eine community-getriebene Plattform, die über 300 Skripte zur Verfügung stellt, um die Verwaltung und Einrichtung der Proxmox Virtual Environment (VE) zu vereinfachen. Sie richtet sich sowohl an erfahrene Nutzer als auch an Einsteiger im Homelab-Bereich. Neben einer umfangreichen Sammlung von Automatisierungsskripten bietet die Seite auch eine FAQ-Sektion, die häufige Fragen zur Installation, Fehlerbehebung und Aktualisierung von Anwendungen beantwortet. Die Plattform ist offen zugänglich, der Quellcode ist auf GitHub verfügbar, und sie wird aktiv von der Community gepflegt.

Proxmox VE Helper-Scripts

Proxmox UPS Shutdown

Installation APC Dienste

apt install apcupsd

Konfiguration Master Server (bei dem die USV via USB Kabel verbunden ist)

nano /etc/apcupsd/apcupsd.conf

UPSCABLE usb
UPSTYPE usb
NETSERVER on
NISIP 0.0.0.0

Konfiguration Slave Server

nano /etc/apcupsd/apcupsd.conf

UPSCABLE ether
UPSTYPE net
DEVICE 10.2.51.1:3551 //IP vom Master Server

Dienste installieren und starten

service apcupsd start

apt install apcupsd-cgi
apt install apache2
a2enmod cgi
systemctl restart apache2

VMs herunterfahren

Skript zur kontrollierten Abschaltung von virtuellen Maschinen in Proxmox, wenn ein Stromausfall erkannt wird. 
HA wird zuvor bei den VMs deaktiviert um ein automatisches Neustarten zu verhindern.

/etc/apcupsd/shutdownvms.sh

#!/bin/bash
# Create list of VM Ids
running_vms=$(qm list | awk '/running/ {print $1}')
# Shutdown each VM
for vmid in $running_vms; do
    echo $(date +"%Y-%m-%d_%H-%M-%S ")"Disable HA For VM: "$vmid >> /var/log/shutdownvm.log
    ha-manager set $vmid --state ignored
    echo $(date +"%Y-%m-%d_%H-%M-%S ")"Shutdown VM: "$vmid >> /var/log/shutdownvm.log
    qm shutdown $vmid --skiplock
    sleep 2
done

Einstellung in /etc/apcupsd/apccontrol

 doshutdown)
        echo "UPS ${2} initiated Shutdown Sequence" | ${WALL}
        /etc/apcupsd/shutdownvms.sh
        ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown"
    ;;

Shutdown-Zeit einstellen

/etc/apcupsd/apcupsd.conf

ZFS Recovery bei Disk-Fehler

Um bei ZFS die Disks einfacher zu erkennen sollte die Seriennummer vor Einbau notiert werden. Dadurch kann bei einem Fehler die Disk einfacher erkannt und ausgetauscht werden

Status überprüfen

Via Proxmox Webinterface oder via CLI:

zpool status

Disk tauschen:

Die Fehlerhafte Disk aus dem Server ausbauen und neue einbauen. Danach die neue Disk suchen:

ls -l /dev/disk/by-id/

Neue Disk einbinden

Neue Disk in ZFS einbinden und resilver durchführen

# bestehendes Dateisystem auf neuer (falls vorhanden) Disk löschen
wipefs -a /dev/disk/by-id/<new_disk_id>

# Disk ersetzen
zpool replace rpool <failed_disk_id> /dev/disk/by-id/<new_disk_id>

Monitoring Resilvering Process

zpool status

Proxmox ZFS-Verschlüsselung aktivieren

Erstellen

# Encrypted Dataset erstellen
 
zpool create -f -o ashift=12 VMStoragePool mirror /dev/sdc /dev/sdd

zfs create -o encryption=on -o keyformat=passphrase VMStoragePool/VMStorage

pvesm add zfspool encryptedVMStorage -pool VMStoragePool/VMStorage

Nach Neustart neu Einbinden

zfs mount -l VMStoragePool/VMStorage

pvesm add zfspool encryptedVMStorage -pool VMStoragePool/VMStorage

HP Proliant Proxmox Treiber

Treiberinstallation/Serviceinstallation um die Lüftersteuerung zu verbessern.

bei den HP Treibern gibt es 2 Versionen

  1. Für Server der Generation 10 oder neuer: amsd
  2. Für Server bis zur Generation 9: hp-ams

Vorbereitung

apt-get install pciutils wmtemp lm-sensors

Generation 10 oder neuer

vi /etc/apt/sources.list

# Repository einfügen

deb http://downloads.linux.hpe.com/SDR/repo/mcp bookworm/current non-free

# Keys hinzufügen
curl http://downloads.linux.hpe.com/SDR/hpPublicKey1024.pub > hp1.key
curl http://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub >hp2.key
curl http://downloads.linux.hpe.com/SDR/hpPublicKey2048_key1.pub > hp3.key
curl http://downloads.linux.hpe.com/SDR/hpPublicKey2048.pub  >hp4.key

apt-key add /root/hp1.key
apt-key add /root/hp2.key
apt-key add /root/hp3.key
apt-key add /root/hp4.key

apt update
apt install amsd 

Generation 9 oder älter

apt-get update

wget -O- https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub | gpg --dearmor > /usr/share/keyrings/hpePublicKey2048-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/hpePublicKey2048-archive-keyring.gpg] http://downloads.linux.hpe.com/SDR/repo/mcp bookworm/current non-free" > /etc/apt/sources.list.d/hpe.list
 

apt-get update && apt-get install ssa ssacli ssaducli storcli hponcfg

wget https://downloads.linux.hpe.com/SDR/repo/mcp/debian/pool/non-free/hp-ams_2.8.3-3056.1ubuntu16_amd64.deb

dpkg -i hp-ams_2.8.3-3056.1ubuntu16_amd64.deb

rm hp-ams_2.8.3-3056.1ubuntu16_amd64.deb

apt install hp-ams 

https://downloads.linux.hpe.com/SDR/project/mcp/

How to fix the missing HPE’s public keys | sleeplessbeastie’s notes

[citepress style=“apa“]