Getting started
cv4pve-autosnap runs outside the cluster (on your workstation, a management VM or a scheduled job) and talks only to the Proxmox VE REST API on port 8006. Nothing is installed on the nodes.
Installation
Section titled “Installation”| Platform | How |
|---|---|
| Linux | wget https://github.com/Corsinvest/cv4pve-autosnap/releases/latest/download/cv4pve-autosnap-linux-x64.zip && unzip cv4pve-autosnap-linux-x64.zip && chmod +x cv4pve-autosnapARM: cv4pve-autosnap-linux-arm64.zip, cv4pve-autosnap-linux-arm.zip |
| Debian / Ubuntu | sudo dpkg -i cv4pve-autosnap-VERSION-ARCH.deb (amd64, arm64, armhf) |
| RHEL / Fedora | sudo rpm -i cv4pve-autosnap-VERSION-ARCH.rpm (x86_64, aarch64, armv7hl) |
| Arch Linux | yay -S cv4pve-autosnap |
| Windows (WinGet) | winget install Corsinvest.cv4pve.autosnap |
| Windows (manual) | cv4pve-autosnap.exe-win-x64.zip, also x86 and arm64 |
| macOS (Homebrew) | brew install corsinvest/tap/cv4pve-autosnap |
| macOS (installer) | cv4pve-autosnap-VERSION-arm64.pkg (Apple silicon) or -x86_64.pkg (Intel) |
| macOS (manual) | cv4pve-autosnap-osx-arm64.zip or cv4pve-autosnap-osx-x64.zip |
Binaries are self-contained: no .NET runtime to install. All files are on thelatest release page.
The API library behind the tool is also on NuGet, as Corsinvest.ProxmoxVE.AutoSnap.Api, for .NET applications that want to take snapshots with the same rules.
First run
Section titled “First run”Create a dedicated user and API token first: see Permissions. Then point the tool at any node:
cv4pve-autosnap --host=pve1.local --api-token='autosnap@pve!snap=<uuid>' --vmid=100 statusSeveral nodes, username and password, certificates and options in a file for scheduled runs: see Connection.
Order of the options
Section titled “Order of the options”The connection options, --vmid and the other global options
go before the command; the options of the command go after it:
cv4pve-autosnap --host=pve1 --api-token='…' --vmid=@all --max-parallel=2 snap --label=daily --keep=7# └──────────── global options ──────────────────────────┘ └──── command options ────┘An option in the wrong place stops the tool with Unrecognized command or argument.
Try it first
Section titled “Try it first”--dry-run connects, selects the guests and checks the storages, then prints what it would do without
creating or removing anything:
cv4pve-autosnap --host=pve1 --api-token='…' --vmid=1000 --dry-run snap --label=daily --keep=7ACTION SnapPVE Version: 8.4.21VMs: 1000Label: dailyKeep: 7State: FalseOnly running: FalseTimeout: 30 sec.Timestamp format: yyMMddHHmmssMax % Storage : 95% Storage Type Valid Used % Disk Size Disk Usage pve01/datapool zfspool Ok 20 5.44 TB 1.09 TB pve01/local-zfs zfspool Ok 0 357.11 GB 98.3 KB----- VM 1000 qemu running -----Create snapshot: autodaily260929091742VM execution 00:00:00.0349731Total execution 00:00:00.2065907First the settings of the run, then the storages that hold guest disks on the nodes involved, with their
usage, then one block per guest. Without --dry-run the same command creates the snapshot
autodaily260929091742 and, if VM 1000 already has seven daily snapshots, removes the oldest.
Take snapshots
Section titled “Take snapshots”# every VM and container of the cluster, keep the last 7 "daily" snapshots of eachcv4pve-autosnap --host=pve1 --api-token='…' --vmid=@all snap --label=daily --keep=7
# what is there nowcv4pve-autosnap --host=pve1 --api-token='…' --vmid=@all status --label=dailyThe exit code is 0 when every guest got its snapshot and its old ones removed, 1 when one did not:
see Commands.
- Choosing guests: IDs, names, pools, tags, nodes and exclusions.
- Labels and retention: how snapshots are named, counted and removed.
- Scheduling: run it every hour, day or week with cron or the Task Scheduler.
- Snapshot consistency: the QEMU guest agent and databases.