basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    A Proxmox snapshot isn’t a backup: it’s on the same disk and holds space

    A snapshot before an update rolls back a bad change in seconds, but it lives on the same storage as the guest’s disk: when the disk dies, both the VM and its snapshots are gone. On top of that a snapshot holds on to old blocks, and the longer it lives, the more space it takes. Take a snapshot before a change and delete it once you’re sure everything works; the copy for when things go wrong is a backup on another disk.

    What a snapshot can and can’t do:

    Snapshot vzdump backup
    where it lives where the guest’s disk is on another storage: NAS, a second disk, PBS
    how long it takes seconds minutes to hours
    rollback seconds, qm rollback a restore, minutes
    survives the disk dying no yes, if the storage is different
    survives the guest being deleted no: qm destroy deletes the snapshots too yes
    what it costs grows over time: keeps old versions of changed blocks space — one copy per day of retention

    Hence the order for a risky change — an OS upgrade in the guest, a database version change, a network edit:

    qm snapshot 101 before-upgrade --description "before upgrading to 26.04"
    # make the change, check, live with it for a day or two
    qm delsnapshot 101 before-upgrade        # everything works — the snapshot isn't needed anymore
    # it doesn't work:
    qm rollback 101 before-upgrade

    Why not keep snapshots for months:

    • Space. On LVM-thin and ZFS a snapshot keeps the blocks that were overwritten after it. A VM with a database rewrites its disk several times a month, and the snapshot grows to the size of the disk. On a thin pool that’s the road to 100 % full (Proxmox storage).
    • Speed. With qcow2 every snapshot is one more link in the chain, and reads go through all the links.
    • On ZFS you can roll back only to the latest one. To go back to a month-old snapshot you have to delete every newer snapshot.
    • A rollback returns everything. Along with the bad change, you lose the data the VM wrote after the snapshot: mail, database records, uploaded files.

    Before a change that touches data, do both: a snapshot for a quick rollback and a fresh backup — Backup now on the VM — in case you have to roll back from another host (Backups in Proxmox).

    How to check

    qm listsnapshot 101        # only fresh snapshots, each with a clear reason in the description
    lvs pve | grep snap        # snapshot volumes on LVM-thin and how much they take