Bin mit ZFS Snapshots total durcheinander

mhbosch

Member
Dec 22, 2020
28
0
6
51
Hallo,

zuerst einmal sorry für die Kategorie. Wenn es hier nicht zu Proxmox gehört, einfach löschen oder verschieben.

Ich habe mir auf dem Proxmox Servern eine ZFS Snapshot Strategie aufgebaut, in der ich meine Bilder etc sende.
Nach einem Stromausfall war das Backupsystem erst nicht gemountet und nun sind meine Shnapshots, die stündlich erstellt werden, nicht mehr synchron.
Daraufhin habe ich alle Snapshots gelöscht, aber ein Senden schlägt fehl, da auf dem Ziel Snapshots fehlen.
Ich habe ja die Quelle sauber, könnte also neu aufbauen, aber bekomme den alten Pool nicht unbenannt.
Also, ich stehe momentan auf "dem Schlauch" wie ich eine Datensicherung wieder hinbekomme.

Setting:
Quelle / Ziel

NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
Backup 3.62T 522G 3.12T - - 0% 14% 1.00x ONLINE -
tank 10.9T 9.94T 990G - - 21% 91% 1.00x ONLINE -

In tank ist zb das Verzeichnis Bilder, das ich mit send/recv auf die andere Platte mit Backup sende.
Es sind im Backup 3 Ziele, Bilder/Datenablage/VM als Namen.

Beim Senden bekomme ich dann folgende Meldung: cannot receive incremental stream: most recent snapshot of Backup/Datenablage does not match incremental source

Verständlich. Aber ich kann anscheinend keinen kompletten Abgleich mehr machen. Daher wollte ich es neu aufbauen, aber bekomme, wie beschrieben nicht hin.
Es wäre Super, wenn mir jemand eine Hilfestellung geben kann.

Viele Grüße,

Michael
 
Wie genau sendest du denn die Snapshots? Einfach mit zfs send -i über ein selbstgebautes Script? Über ein sync script was du fertig im Netz gefunden hast? Über TrueNAS?

Wenn du bei "zfs receive" das "-F" Flag setzt, dann wird er einfach alles einmal komplett neu syncen, wenn inkrementelles Senden nicht mehr geht, da die Snapshots nicht mehr synchron sind: https://openzfs.github.io/openzfs-docs/man/8/zfs-recv.8.html:
-F
Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by zfs send -R [-i|-I]), destroy snapshots and file systems that do not exist on the sending side.
 
Last edited:
Hallo und danke für die Rückmeldung.

Also ich nutze das Script in einem stündlichen Aufruf.


Code:
SOURCE_POOL="tank"
BACKUP_POOL="Backup"
DATASETS=("Bilder" "Datenablage")
LATEST_PROP="backup:latest"


for DATASET in ${DATASETS[@]}
do
  zpool get -Hp -o value free ${BACKUP_POOL} >/dev/null 2>&1 || {
    echo "ZFS backup pool (${BACKUP_POOL}) not found!"
    exit 1
  }


  LATEST=$(zfs get -H -o value ${LATEST_PROP} ${BACKUP_POOL}/${DATASET})
  echo "Latest Prop ${LATEST} für Dataset ${DATASET}"
  if [ ${LATEST} == "-" ]; then
    echo "No property '${LATEST_PROP}' with last backup date found in backup pool ('${BACKUP_POOL}')!"
    echo "If you don't have a last backup please create one using the following commands:"
    echo '# SNAPSHOT=$(date +"%F")'
    echo "# zfs snapshot ${SOURCE_POOL}/${DATASET}@\${SNAPSHOT}"
    echo "# zfs send ${SOURCE_POOL}/${DATASET}@\${SNAPSHOT} | zfs receive -F ${BACKUP_POOL}/${DATASET}@\${SNAPSHOT}"
    echo "# zfs set ${LATEST_PROP}=\${SNAPSHOT} ${BACKUP_POOL}"
    echo "If the script is run as a regular user then please ensure the following permissions are set:"
    echo "- send,snapshot on the SOURCE_POOL"
    echo "- compression,mountpoint,mount,create,receive,userprop on the BACKUP_POOL"
    exit 1
  else
    SNAPSHOT=$(date +"%Y-%m-%d-%H%M")
    if [ ${LATEST} == ${SNAPSHOT} ]; then
      echo "Last backup is identical with current snapshot (${SNAPSHOT})!"
      echo "Please investigate and fix manually."
      exit 1
    else
      echo "Erstelle Snapshot von ${LATEST} zu ${SNAPSHOT}."
      zfs snapshot "${SOURCE_POOL}/${DATASET}@${SNAPSHOT}"
      echo "Snapshot fertig, sende Snapshot an den Backup Bereich..."
      zfs send -I ${LATEST} "${SOURCE_POOL}/${DATASET}@${SNAPSHOT}" | zfs receive -F "${BACKUP_POOL}/${DATASET}@$SNAPSHOT"
      echo "Setting ${LATEST_PROP} on ${BACKUP_POOL} pool."
      zfs set ${LATEST_PROP}=${SNAPSHOT} ${BACKUP_POOL}/${DATASET}
      echo "Vorgang erfolgreich."
    fi
  fi



Also sende ich immer mit "-F", Dennoch kommt der Fehler.
 
So,

ich habe mein Backup Pool mit destroy gelöscht, alle Snapshots gelöscht und neu aufgebaut. Nun läuft alles wieder.

:)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!