[TUTORIAL] ZFS not most recent snapshot bypass

H4R0

Well-Known Member
Apr 5, 2020
616
142
48
In case you use autosnapshot or other tools to do periodic zfs snapshots and thus can't use the roolback feature of pve.

1613518747623.png

This patch enforces the rollback, execute as root in terminal:
Code:
cat << 'EOF' > /etc/cron.hourly/proxmox-zfs-rollback-force
#!/bin/bash
FILE="/usr/share/perl5/PVE/Storage/ZFSPoolPlugin.pm"
grep "'rollback', \"" $FILE >/dev/null && sed -i "s/'rollback', \"/'rollback', '-rf', \"/g" $FILE && sed -i "s/if \$snap ne \$recentsnap;/if 0;/g" $FILE && systemctl restart pvedaemon || exit 0
EOF

chmod +x /etc/cron.hourly/proxmox-zfs-rollback-force

bash /etc/cron.hourly/proxmox-zfs-rollback-force

Note: A rollback deletes all snapshots taken afterwards
 
Last edited:
  • Like
Reactions: Dunuin

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!