Virtualization / 2026-05-17
Snapshot strategy for containers: don't mistake snapshots for backups
Snapshots for LXC in PVE are cheap, but snapshots and backups solve two different problems. This post lays out when to snapshot and when you must back up.
"I took a snapshot, so I'm safe" — that sentence turns into a disaster on the day the disk dies. Snapshots live on the same disk as the original data; the disk goes, both go.
What snapshots are good for
- A rollback point before an upgrade (changing config, switching versions, installing new dependencies)
- Temporary experiments (try an approach, throw it away if it doesn't work)
- Operational mistakes you need to undo within a minute
Snapshots are not for: protecting against hardware failure, protecting against deleting a whole machine, protecting against ransomware.
Naming and cadence
My rule is to put the purpose and date in the snapshot name — don't use the default snapshot1:
pct snapshot 101 before-upgrade-2026-05 --description "before upgrade:3x-ui 2.4 → 2.5"
pct listsnapshot 101
pct rollback 101 before-upgrade-2026-05
Retention policy: keep only the last two or three, delete them when you're done. Snapshots pin the underlying blocks, disk usage grows with every write, and a container with a dozen snapshots stacked up will eventually fill the storage.
pct delsnapshot 101 before-upgrade-2026-05
Backup is the real line of defense
What actually protects against hardware failure is vzdump to another machine or to remote storage:
vzdump 101 --mode snapshot --storage nas --compress zstd
--mode snapshot takes a temporary snapshot first and then packs it, so service isn't interrupted; the temporary snapshot is deleted automatically once the backup finishes.
A detail that's easy to overlook
An LXC container's "data" often isn't inside the container — bind mounts point at host directories, and vzdump by default does not include those directories.
cat /etc/pve/lxc/101.conf | grep mp0
If you see mp0: /srv/data,mp=/data, then /srv/data needs a backup of its own. This is the classic reason why after a restore "the container comes up but the data is empty."
My actual combination
| Scenario | Action | Frequency |
|---|---|---|
| Config change / upgrade | Snapshot | Before every operation |
| Daily data | restic incrementals to remote | Daily |
| Whole machine | vzdump to NAS | Weekly |
| Restore drill | Pick one machine, restore it and boot it | Monthly |
Only the first of those four rows is a snapshot. The other three are the part that means "still alive even if the disk dies."
The difference between the three kinds of snapshots
In PVE, "snapshot" is actually three different things, and mixing them up causes problems:
| Type | Command | Cost | Use for |
|---|---|---|---|
| LXC snapshot | pct snapshot | Seconds, copy-on-write | Before config changes |
| QEMU internal snapshot | qm snapshot | Requires qcow2, performance drop | Short-cycle rollback |
| vzdump backup | vzdump | Slow, uses space | Off-site archiving |
LXC snapshots rely on the underlying storage (ZFS/LVM-thin); directory storage doesn't support them. When someone's first snapshot attempt fails, it's usually because they're on dir storage.
Strategy: three layers
- Snapshot before changes: before touching
/etc/pve/lxc/*.conf, swapping a kernel, or adjusting a NIC, runpct snapshot 101 pre-change-$(date +%m%d). - Daily backup: run
vzdumpon a schedule, keep 7 days, store on another disk. - Quarterly drill: actually restore to a temporary CTID and confirm the backup comes up.
The third layer is the one most often skipped, but it's the only one that proves "the backup is valid."
A capacity trap
On LVM-thin, snapshots take no space until the original volume is rewritten. Change 20G of data and the snapshot eats 20G. Once the pool is full, writes fail outright — the symptom is a container that looks hung, with no space left in the logs.
lvs -a -o lv_name,lv_size,data_percent,pools
When data_percent goes above 80%, it's time to clear snapshots or grow the pool.
Deletion order
Delete the snapshots before deleting the container; the other way around leaves orphan volumes. Batch cleanup:
pct listsnapshot 101
pct delsnapshot 101 pre-change-0815