Hi all,
i'm a new proxmox user and i'm tryng to get better strategy to backup root pve partitition.
I've installed proxmox into a ssd, also vm/lxc data config are stored here but external ssd with passthourgh are used for data storage.
I like a feedback from your for best DR strategy in case of disk failure (raid is used only for data storage, not for root)
My combo is:
rsync /etc --- > external fat32 disk (slow recovery)
zfs send/rcv --> external disk (fast recovery.... so install proxmox on new disk and then restore the pool to mount on /)
external disks for both are attached to truenas vm inside proxmox and shared via NFS
i asked to chatgpt a script for second point with following requiremet:
what do you think?
do you have any suggestion?
important point that i found during my test and i posted to chatgpt attentions are: recursive snapshot to avoid missing dataset and avoid autmounting point (during snapshot test on external disk, i was affected by slow performance and other strange stuff... then i noticed that / was mount on both ssd and external disk! )
i'm a new proxmox user and i'm tryng to get better strategy to backup root pve partitition.
I've installed proxmox into a ssd, also vm/lxc data config are stored here but external ssd with passthourgh are used for data storage.
I like a feedback from your for best DR strategy in case of disk failure (raid is used only for data storage, not for root)
My combo is:
rsync /etc --- > external fat32 disk (slow recovery)
zfs send/rcv --> external disk (fast recovery.... so install proxmox on new disk and then restore the pool to mount on /)
external disks for both are attached to truenas vm inside proxmox and shared via NFS
i asked to chatgpt a script for second point with following requiremet:
You want to backup rpool/ROOT/pve-1 recursively
You want to avoid mounting the replicated datasets (to prevent conflicts like a second / mount)
You still want daily backups at 3 AM, retention of 10 days, and basic verification
- Snapshot exists on destination
Dataset is not mounted (as intended)
zpool status of backup pool is healthy
zfs scrub is recent or run manually after backup
Optionally: compare checksums of source vs backup (if file-level check needed — optional)
Code:
#!/bin/bash
set -e
# Variables
SRC="rpool/ROOT/pve-1"
DST="nfsbackuppool/backups/pve-1"
SNAP_PREFIX="autosnap"
DATE=$(date +%F)
SNAP_NAME="${SNAP_PREFIX}-${DATE}"
LOG_FILE="/var/log/zfs_nfs_backup.log"
BACKUP_POOL="nfsbackuppool"
log() {
echo "$(date '+%F %T') $*" | tee -a "$LOG_FILE"
}
# 1. Create recursive snapshot
log "[INFO] Creating snapshot: ${SRC}@${SNAP_NAME}"
zfs snapshot -r "${SRC}@${SNAP_NAME}"
# 2. Send snapshot recursively, unmounted
log "[INFO] Sending snapshot recursively to ${DST}"
zfs send -R "${SRC}@${SNAP_NAME}" | zfs receive -uF "$DST"
# 3. Prune old snapshots (source)
log "[INFO] Pruning old snapshots from source"
zfs list -H -t snapshot -o name -s creation | \
grep "^${SRC}@" | grep "${SNAP_PREFIX}-" | \
head -n -10 | xargs -r -n1 zfs destroy
# 4. Prune old snapshots (destination)
log "[INFO] Pruning old snapshots from destination"
zfs list -H -t snapshot -o name -s creation | \
grep "^${DST}@" | grep "${SNAP_PREFIX}-" | \
head -n -10 | xargs -r -n1 zfs destroy
# 5. Verify snapshot exists on destination
log "[INFO] Verifying snapshot on destination"
if zfs list -t snapshot "${DST}@${SNAP_NAME}" >/dev/null 2>&1; then
log "[OK] Snapshot exists: ${DST}@${SNAP_NAME}"
else
log "[ERROR] Snapshot not found: ${DST}@${SNAP_NAME}"
exit 1
fi
# 6. Check that backup dataset is not mounted
MOUNTPOINT=$(zfs get -H -o value mounted "${DST}")
if [ "$MOUNTPOINT" = "no" ]; then
log "[OK] Dataset is not mounted (as expected)"
else
log "[WARNING] Dataset is mounted unexpectedly"
fi
# 7. Check zpool health
log "[INFO] Checking backup pool status"
POOL_STATUS=$(zpool status -x "$BACKUP_POOL")
if [[ "$POOL_STATUS" == "all pools are healthy" || "$POOL_STATUS" == "$BACKUP_POOL is healthy" ]]; then
log "[OK] Backup zpool '$BACKUP_POOL' is healthy"
else
log "[ERROR] zpool '$BACKUP_POOL' is not healthy"
zpool status "$BACKUP_POOL" >> "$LOG_FILE"
exit 1
fi
# 8. Run scrub and wait (optional - long running)
log "[INFO] Running scrub on backup pool: $BACKUP_POOL"
zpool scrub "$BACKUP_POOL"
# Optional: wait for scrub completion (skip if not wanted)
# log "[INFO] Waiting for scrub to complete..."
# while zpool status "$BACKUP_POOL" | grep -q "scrub in progress"; do sleep 10; done
# log "[OK] Scrub completed"
log "[SUCCESS] Backup completed and verified successfully."
exit 0
what do you think?
do you have any suggestion?
important point that i found during my test and i posted to chatgpt attentions are: recursive snapshot to avoid missing dataset and avoid autmounting point (during snapshot test on external disk, i was affected by slow performance and other strange stuff... then i noticed that / was mount on both ssd and external disk! )
Last edited: