百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

cv4pve-autosnap

> 数据库
开源

支持保留策略的 Proxmox VE VM 和容器的自动快照工具

560 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

支持保留策略的 Proxmox VE VM 和容器的自动快照工具

cv4pve-autosnap

     ______                _                      __
    / ____/___  __________(_)___ _   _____  _____/ /_
   / /   / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
  / /___/ /_/ / /  (__  ) / / / / |/ /  __(__  ) /_
  \____/\____/_/  /____/_/_/ /_/|___/\___/____/\__/

Automatic Snapshot Tool for Proxmox VE (Made in Italy)

Automatic snapshot management for Proxmox VE — create, retain and clean snapshots of VM/CT with a single command.


Quick Start

bash
wget https://github.com/Corsinvest/cv4pve-autosnap/releases/download/VERSION/cv4pve-autosnap-linux-x64.zip
unzip cv4pve-autosnap-linux-x64.zip
./cv4pve-autosnap --host=YOUR_HOST --api-token=user@realm!token=uuid --vmid=100 snap --label=daily --keep=7

Installation

Platform Command
Linux wget .../cv4pve-autosnap-linux-x64.zip && unzip cv4pve-autosnap-linux-x64.zip && chmod +x cv4pve-autosnap
Windows WinGet winget install Corsinvest.cv4pve.autosnap
Windows manual Download cv4pve-autosnap-win-x64.zip from Releases
Arch Linux yay -S cv4pve-autosnap
Debian/Ubuntu sudo dpkg -i cv4pve-autosnap-VERSION-ARCH.deb
RHEL/Fedora sudo rpm -i cv4pve-autosnap-VERSION-ARCH.rpm
macOS Homebrew: brew tap Corsinvest/homebrew-tap && brew install cv4pve-autosnap (tap repo)
Manual: wget .../cv4pve-autosnap-osx-x64.zip && unzip cv4pve-autosnap-osx-x64.zip && chmod +x cv4pve-autosnap

All binaries on the Releases page.


Features

  • Self-contained binary — no runtime to install, copy and run
  • Cross-platform — Windows, Linux, macOS
  • API-based — no root or SSH access required
  • Cluster-aware — works across all nodes automatically
  • High availability — multiple host support for automatic failover
  • Flexible targeting — select VMs by ID, name, pool, tag, node or pattern (see VM/CT Selection)
  • Retention policies — configurable keep count per label
  • Multiple schedules — use labels (hourly, daily, weekly, monthly) (see Scheduling)
  • Memory state — optional RAM state preservation with --state
  • Hook scripts — custom automation before/after each phase (see Hook Scripts)
  • Storage monitoring — skip snapshot if storage above threshold
  • QEMU Guest Agent — warns if not enabled on a VM; recommended for consistent snapshots (setup guide)
  • Parallel execution — snapshot multiple VMs concurrently with --max-parallel (see Performance)
  • API token support (Proxmox VE 6.2+)
  • Dry-run mode — test without making changes

Security & Permissions

Required Permissions

Permission Purpose Scope
VM.Audit Read VM/CT configuration and status Virtual machines
VM.Snapshot Create and delete snapshots Virtual machines
Datastore.Audit Check storage capacity Storage systems
Pool.Audit (PVE 9+) / Pool.Allocate (PVE 8 and earlier) Read pool membership (needed for --vmid=@pool-*) Resource pools

Pool selection (--vmid=@pool-*) resolves the pool via GET /pools. On Proxmox VE 9+ that endpoint requires the read-only Pool.Audit privilege; on PVE 8 and earlier it accepted Pool.Allocate. If pool targeting returns "VMs NOT FOUND" on PVE 9, grant Pool.Audit to the token/role. See the Proxmox VE User Management docs.


Usage

…

Performance

By default snapshots are processed sequentially (--max-parallel 1). On large clusters with VMs spread across multiple nodes or using ZFS/Ceph storage, parallel execution significantly reduces total run time.

bash
# Run up to 5 snapshots in parallel
cv4pve-autosnap --host=pve.local --api-token=token --vmid=@all snap --label=daily --keep=7 --max-parallel 5
Setting Effect Default
--max-parallel 1 Sequential — one VM at a time default
--max-parallel N Up to N VMs snapshotted concurrently —

Tip: values between 3 and 10 are a reasonable range. ZFS and Ceph handle parallel snapshots very well.

Warning: if multiple VMs share the same storage backend, parallel snapshots compete for the same I/O — this can slow down or destabilize the storage. On shared or slow storage (NFS, iSCSI, LVM) keep --max-parallel low (2–3) or leave it at the default of 1. On distributed storage (Ceph/RBD) or per-VM storage (ZFS datasets) higher values are safe.


VM/CT Selection

The --vmid parameter supports powerful pattern matching:

Pattern Example Description
Single ID --vmid=100 Specific VM/CT by ID
Single name --vmid=web-server Specific VM/CT by name
Multiple --vmid=100,101,web-server Comma-separated list
Range --vmid=100:110 Range of IDs (inclusive)
Wildcard --vmid=%web% Contains pattern
All VMs --vmid=@all All VMs in cluster
Pool --vmid=@pool-production All VMs in specific pool
Tag --vmid=@tag-backup All VMs with specific tag
Node --vmid=@node-pve1 All VMs on specific node
Exclusion --vmid=@all,-100,-test-vm Exclude specific VMs
Tag exclusion --vmid=@all,-@tag-test Exclude VMs with tag

Scheduling with Cron

bash
# Daily snapshot at 2 AM (keep 7 days)
0 2 * * * /usr/local/bin/cv4pve-autosnap --host=pve.local --api-token=backup@pve!daily=uuid --vmid=@tag-production snap --label=daily --keep=7

# Weekly snapshot on Sunday at 3 AM (keep 4 weeks)
0 3 * * 0 /usr/local/bin/cv4pve-autosnap --host=pve.local --api-token=backup@pve!weekly=uuid --vmid=@all snap --label=weekly --keep=4

# Monthly cleanup on 1st at 4 AM
0 4 1 * * /usr/local/bin/cv4pve-autosnap --host=pve.local --api-token=backup@pve!clean=uuid --vmid=@all clean --label=monthly --keep=12

Hook Scripts

Hook scripts receive environment variables for custom automation:

…

Available phases

Phase Description
snap-job-start Before the entire snap job starts
snap-job-end After the entire snap job ends
snap-create-pre Before creating a snapshot for a VM
snap-create-post After creating a snapshot for a VM
snap-create-abort When snapshot creation fails
snap-remove-pre Before removing an old snapshot
snap-remove-post After removing an old snapshot
snap-remove-abort When snapshot removal fails
clean-job-start Before the entire clean job starts
clean-job-end After the entire clean job ends

Example Hook Script

bash
#!/bin/bash
case $CV4PVE_AUTOSNAP_PHASE in
    "snap-create-pre")
        echo "Starting snapshot for VM $CV4PVE_AUTOSNAP_VMID"
        ;;
    "snap-create-post")
        echo "Completed snapshot $CV4PVE_AUTOSNAP_SNAP_NAME"
        ;;
esac

Using Hook Scripts

bash
cv4pve-autosnap --host=pve.local --api-token=token --vmid=100 snap --label=daily --keep=7 --script-hook=/opt/scripts/hook.sh

Ready-to-use templates (Bash, PowerShell, Windows Batch) are available in the hooks/ folder.

For snapshot consistency with running databases (MySQL, PostgreSQL) and QEMU Guest Agent setup, see docs/snapshot-consistency.md.


Resources

Web GUI version: cv4pve-admin


Support

Professional support and consulting available through Corsinvest.


Part of cv4pve suite | Made with ❤️ in Italy by Corsinvest

Copyright © Corsinvest Srl

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#automationautosnapbackupcli

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库