Proxmox VE备份策略
虚拟备份
#!/usr/bin/env bash
# 描述: Proxmox 虚拟机备份脚本,并实现自动清理
set -e
KEEPDAYS=3
NAME="snapshot-$(date +%Y-%m-%d_%H-%M-%S)"
BACKUP_DIR=/backup/dump
VMIDS=(
100
150
151
152
153
154
200
241
)
for VMID in ${VMIDS[@]}
do
if ! vzdump --compress zstd $VMID --dumpdir ${BACKUP_DIR} --prune-backups keep-daily=${KEEPDAYS}; then
logger -t "$(basename $0)" "[ ${VMID} ] backup status [ failed ]."
exit 1
fi
done
此时,在脚本定义备份好的VM,都会保留3份备份。