How to Snapshot and Clone LXC Containers in Proxmox
Snapshot Proxmox LXC containers with pct before every change and roll back in seconds. Covers ZFS vs ext4, pct rollback workflow, and staging clones.
On this page
Taking a snapshot of an LXC container in Proxmox VE takes about two seconds on ZFS or LVM-Thin storage, and rolling back takes three more. That speed makes it practical to snapshot before every meaningful change: package upgrades, config edits, or anything you might need to undo at 2 AM. This guide walks through pct snapshot, pct rollback, and pct clone on Proxmox VE 9.1, covering which storage backends give you real disk snapshots, the exact CLI workflow for safe updates, and how to spin up a staging clone of any container in under 30 seconds.
Key Takeaways
- ZFS and LVM-Thin only: These are the only backends that give you full copy-on-write disk snapshots; directory (ext4) storage captures config and RAM state only, not the container filesystem.
- Near-instant creation: A snapshot on a 20 GB ZFS dataset takes 1-2 seconds regardless of how full the container is.
- Rollback is total: Every write since the snapshot timestamp is lost on rollback; there is no partial restore.
- Clones are independent:
pct clonecreates a fully separate container; changes to the clone do not affect the source. - Delete old snapshots: LVM-Thin snapshots consume space proportional to writes after creation; undeleted snapshots will silently fill your pool.
How LXC Snapshots Work in Proxmox VE 9.1
LXC snapshots in Proxmox work differently from KVM VM snapshots, and the difference matters. A VM snapshot captures the entire virtual disk image state through QEMU. An LXC container shares the host kernel, so Proxmox snapshots the container's filesystem using the storage backend's native mechanism.
On ZFS, pct snapshot calls zfs snapshot on the container's dataset. This is copy-on-write at the filesystem level: the snapshot is metadata only, costs almost nothing initially, and records the exact state of every block at that moment. On LVM-Thin, the same COW logic applies through LVM's thin snapshot volumes.
The optional --vmstate 1 flag suspends the container, flushes memory to disk, and resumes it. This gives you a crash-consistent memory image alongside the disk snapshot. For most use cases (testing package updates, reverting config changes), skipping --vmstate and capturing disk state only is faster and sufficient.
Which Storage Backends Support Full Disk Snapshots
Not all storage backends support LXC snapshots equally. This is the biggest gotcha for people who install Proxmox with the default settings, which use local directory storage on ext4:
| Backend | Full Disk Snapshot | RAM State | Notes |
|---|---|---|---|
| ZFS (local-zfs) | Yes (native COW) | Yes | Recommended; fast and unlimited |
| LVM-Thin (local-lvm) | Yes (thin snapshot) | Yes | Space grows with writes post-snapshot |
| BTRFS | Yes (subvolume) | Yes | Experimental in Proxmox VE 9 |
| Directory (local, ext4) | No | Yes | Config and RAM dump only |
| NFS / CIFS | No | No | Snapshots not supported |
If your container lives on local directory storage, the Take Snapshot button works but only saves the container config and optional RAM state. Changed files on disk are not captured, and Proxmox does not warn you about this in the UI.
If you are building a private cloud at home with Proxmox VE, picking ZFS or LVM-Thin storage from the start avoids a migration headache later. Migrating an existing container to ZFS storage takes roughly 30 seconds per gigabyte on local NVMe.
Taking Your First LXC Snapshot
You can snapshot from the web UI under Container → Snapshots → Take Snapshot, or via pct. The CLI is faster and scriptable:
# Basic snapshot, disk state only
pct snapshot 101 pre-upgrade-nginx
# With a description (no RAM state)
pct snapshot 101 pre-upgrade-nginx --description "before nginx 1.27 upgrade" --vmstate 0
# List all snapshots for a container
pct listsnapshot 101
The output of pct listsnapshot 101 on a ZFS-backed container looks like this:
-> current
pre-upgrade-nginx (2026-05-11 09:14:32) before nginx 1.27 upgrade
The arrow marks your current position in the snapshot tree. If you accumulate multiple snapshots, keep the chain short: two or three at most. Long chains are harder to reason about and, on LVM-Thin, each additional layer tracks divergence from the next.
To include RAM state for a live checkpoint, set --vmstate 1. The container pauses for 2-8 seconds while memory is flushed to disk. For a 512 MB container running Nginx this is barely noticeable. For a 4 GB Postgres container, plan for the pause.
Rolling Back an LXC Container After a Bad Change
The rollback command stops the container if it is running, restores disk and config state to the snapshot timestamp, and leaves it stopped:
# Roll back to the named snapshot
pct rollback 101 pre-upgrade-nginx
# Start the container after rollback
pct start 101
Total time from broken state to clean state on a 20 GB ZFS dataset: about 8 seconds. The container config (CPU allocation, memory limits, network settings) is also restored to exactly what it was at snapshot time. If you changed resource limits between snapshot and rollback, those changes are gone too.
One honest tradeoff: rollback is total. There is no option to restore just one config file from a snapshot. If you need to recover a single file rather than rolling the whole container back, clone the snapshot into a temporary container (covered next) and copy the file out manually.
Cloning LXC Containers for Safe Staging
pct clone creates an independent copy of a container. Use it to test a major change, like upgrading from PHP 8.2 to 8.3, in an isolated environment before touching production:
# Full clone of container 101 to new ID 200
pct clone 101 200 --full 1 --hostname staging-nginx --storage local-zfs
# Start the clone
pct start 200
# Set a different IP so it does not conflict on the network
pct set 200 --net0 name=eth0,bridge=vmbr0,ip=192.168.10.200/24,gw=192.168.10.1
# Destroy the clone when testing is complete
pct stop 200 && pct destroy 200
The --full 1 flag creates an independent copy of the disk rather than a linked clone. Linked clones share their base volume with the original; deleting the original breaks any linked clones. For staging and testing, full clones are the safer choice.
A full clone of a 10 GB container on local NVMe ZFS completes in about 45 seconds. If you are running Docker inside LXC containers on Proxmox, cloning is particularly useful for testing Docker Compose stack changes before rolling them to the production container.
A Safe Update Workflow Using Snapshots
This is the workflow worth making a habit before any significant change to a production LXC container:
-
Snapshot before touching anything:
# Replace 101 with your container ID pct snapshot 101 pre-$(date +%Y%m%d) --description "pre-maintenance snapshot" -
Apply your change (package upgrades, config edits, new deployments):
pct exec 101 -- apt update && apt dist-upgrade -y -
Test that the service is working: hit the endpoint, check logs, run your smoke test.
-
If everything is fine, delete the snapshot to reclaim storage:
pct delsnapshot 101 pre-$(date +%Y%m%d) -
If something broke, roll back:
pct rollback 101 pre-$(date +%Y%m%d) pct start 101
The $(date +%Y%m%d) produces a datestamp like pre-20260511 so you never need to invent a name. Add a time component ($(date +%Y%m%d-%H%M)) if you snapshot more than once in a day.
LXC Snapshot Limits and Common Pitfalls
Bind mounts are not included in snapshots. If your container has bind mounts pointing to host directories (e.g., a media directory mounted via mp0), those paths are excluded from the snapshot scope. Only the container's own rootfs volume is captured. Data in bind-mounted host paths needs a separate backup strategy.
Directory storage snapshots silently skip disk state. Proxmox lets you snapshot a directory-backed container without any warning that the disk is not captured. Always verify your container's storage type with pvesm status before relying on snapshots for rollback.
LVM-Thin snapshots grow with every write. After you snapshot a 20 GB container and then write 5 GB of data to it, the pool now holds 25 GB. The snapshot tracks every modified block from the original. Delete old snapshots proactively or your thin pool fills faster than you expect.
RAM state requires free disk space equal to container memory. The --vmstate 1 flag writes the entire RAM allocation to disk. Check free space first with df -h on the relevant mount point or zfs list for ZFS pools before using it on large containers.
Nested containers snapshot normally. LXC containers with features: nesting=1 (common for containerized workloads) snapshot fine. The nesting setting is part of the container config and is included in every snapshot and rollback.
When to Use LXC Snapshots vs Proxmox Backup Server
Snapshots and backups solve different problems, and the distinction is worth being explicit about:
| LXC Snapshot | PBS Backup | |
|---|---|---|
| Creation time | 1-3 seconds | 1-10 minutes |
| Off-host recovery | No | Yes |
| Granular file restore | No (full rollback only) | Yes (file browser in PBS 3+) |
| Retention management | Manual | Scheduled, automated |
| Storage location | Same pool as the container | Remote PBS datastore |
| Best for | Quick rollback before changes | Daily automated retention |
Snapshots are not a backup strategy. If the physical disk hosting your Proxmox node fails, your snapshot goes with it. For containers running anything you care about, set up automated backups with Proxmox Backup Server against a separate datastore.
A practical two-layer setup: snapshot before every change for instant same-host rollback, plus PBS backup on a daily schedule to an offsite datastore for real disaster recovery. They complement each other and the overhead is negligible once PBS is configured.
Conclusion
LXC snapshots in Proxmox VE 9.1 are fast enough to make rollback a default reflex before any meaningful change. The key requirement is ZFS or LVM-Thin storage for containers where rollback actually matters; directory-backed containers cannot capture disk state. Once that foundation is in place, pct snapshot and pct rollback add a safety net that takes less time to use than it takes to think about. To complete the picture, configure automated backups with Proxmox Backup Server and you have both instant rollback and off-site recovery covered.