Skip to content

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.

PlatformHow
Linuxwget https://github.com/Corsinvest/cv4pve-autosnap/releases/latest/download/cv4pve-autosnap-linux-x64.zip && unzip cv4pve-autosnap-linux-x64.zip && chmod +x cv4pve-autosnap
ARM: cv4pve-autosnap-linux-arm64.zip, cv4pve-autosnap-linux-arm.zip
Debian / Ubuntusudo dpkg -i cv4pve-autosnap-VERSION-ARCH.deb (amd64, arm64, armhf)
RHEL / Fedorasudo rpm -i cv4pve-autosnap-VERSION-ARCH.rpm (x86_64, aarch64, armv7hl)
Arch Linuxyay -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.

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 status

Several nodes, username and password, certificates and options in a file for scheduled runs: see Connection.

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.

--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=7
ACTION Snap
PVE Version: 8.4.21
VMs: 1000
Label: daily
Keep: 7
State: False
Only running: False
Timeout: 30 sec.
Timestamp format: yyMMddHHmmss
Max % 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: autodaily260929091742
VM execution 00:00:00.0349731
Total execution 00:00:00.2065907

First 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.

# every VM and container of the cluster, keep the last 7 "daily" snapshots of each
cv4pve-autosnap --host=pve1 --api-token='…' --vmid=@all snap --label=daily --keep=7
# what is there now
cv4pve-autosnap --host=pve1 --api-token='…' --vmid=@all status --label=daily

The exit code is 0 when every guest got its snapshot and its old ones removed, 1 when one did not: see Commands.