Skip to main content

How to take VM snapshots and roll back to them

A VM snapshot in vStack Center is a ZFS snapshot of its disk datasets plus a saved copy of the VM configuration at the same point in time. A snapshot is created instantly and initially takes up no space: it grows as disk data diverges from the state at the time of the snapshot.

A snapshot has two names. The user-defined name is set at creation and must follow a strict format: Latin letters, digits, and underscores, up to 128 characters. The internal name is the full ZFS snapshot name; the interface shows only the user-defined part.

A snapshot retains data. While it exists, a disk included in it is not physically deleted: an attempt to delete such a disk marks it as retained, and space is freed only after the snapshot is deleted. This also explains the main rule for managing snapshots: a snapshot is not a backup. It resides on the same pool as the VM and shares the fate of that pool.

Rollback is destructive in both directions. It returns disk data to the snapshot state and deletes snapshots taken after the rollback point. The VM must be stopped.

Snapshots appear in the Snapshots section of the VM card: a table with Name, Date of creation, and Size (GB) columns, and an Add snapshot button.

How to create a snapshot​

Access: Cluster master has full access; other users need a role with role_id ≤ 2 in the VM's VDC (virtual data center).

Prerequisites: the VM configuration version is at least 4, the VM's pool accepts data, and the VM is not locked by another operation.

In the Snapshots section of the VM card, click Add snapshot and enter a name using Latin letters, digits, and underscores, up to 128 characters. The completed snapshot appears in the table with its creation date and space usage.

Failures:

FailureReasonWorkaround
-3608 invalid snapshot nameThe name contains characters other than Latin letters, digits, and underscores, or exceeds 128 charactersRename the snapshot
-3622 configuration version below 4VMs with configuration version three do not support snapshotsUpgrade the VM configuration version
-3625 VM pool does not accept dataThe pool is not operationalWait for the pool to become operational again
-3630 VM is lockedAnother operation is in progressRetry after it finishes
-3620 VM not found within visibility scopeNo access, or the VM does not existCheck permissions and that the correct VM is open
-403 insufficient privilegesThe VDC role has fewer permissions than role_id ≤ 2Request the VDC administrator role

How to view snapshots​

A VM's snapshots are listed in the Snapshots section of its card. The Size (GB) column shows how much space each snapshot currently uses, helping you identify snapshots that should be removed.

The interface does not provide a separate combined list of snapshots for all VMs in the cluster: view them on individual VM cards. Cluster master sees all VMs; an ordinary user sees only VMs in their VDCs. If you need a consolidated list of forgotten snapshots across the cluster, the API provides it (see "API methods").

A failure to read the list returns error -4107, "Unable to retreive snapshots list".

How to delete a snapshot​

Delete the snapshot in the Snapshots section of the VM card. Unlike creation, deletion allows a period in the name, so snapshots created by external tools can be deleted.

Deleting a snapshot releases its holds: along with the snapshot record, vStack Center removes the disks and network ports it retained that remained in the configuration only because of the snapshot. This is why a disk that was "stuck" during deletion disappears along with the snapshot.

Failures: -4321 means the VM has no snapshot with that name, -4330 means the VM is locked, -403 means insufficient privileges, and -4320 means the VM was not found or is not accessible within the visibility scope.

How to roll back a VM to a snapshot​

  1. Stop the VM. Rolling back a running VM is rejected with error -4225.

  2. In the Snapshots section of the VM card, start rollback to the required snapshot.

  3. Check the result: vStack Center restores the VM configuration from the copy saved with the snapshot, reattaches disks and network interfaces, and deletes snapshots taken after the rollback point. Read the snapshot list again after the operation.

What rollback does not restore​

Rollback restores dataset data, but not all VM properties. The following retain their current values:

  • Disk labels.
  • Disk sizes.
  • Disk operations per second and throughput limits.
  • The set of network interfaces and their settings.

In practice, if a disk was expanded or an interface was added between taking the snapshot and rolling back, those changes remain. Adjust those properties manually after rollback.

If rollback is rejected​

FailureReasonWorkaround
-4225 VM must be stoppedThe VM is running or suspendedStop the VM
-4221 snapshot does not existThe name does not match the saved nameUse the name from the Snapshots section
-4224 configuration version below 4Rollback is unavailable for VMs with configuration version threeUpgrade the VM configuration version
-4233 VM pool does not accept dataThe pool is not operationalWait for the pool to return
-4230 VM is lockedAnother operation is in progressRetry later
-4208 invalid snapshot nameThe name fails format validationCheck the name
-403 insufficient privilegesThe role has fewer permissions than role_id ≤ 2Request the VDC administrator role

A separate restriction applies if the VM has existing CoW clones: rollback to a snapshot older than the cloning point is blocked by ZFS while the clone exists. Rollback to newer snapshots still works. To return to an older snapshot, delete the clones first.

See also​

API methods​

The API operations for this page are vms-snapshot, vm-snapshot-list, snapshot-list, vms-snapshot-remove, and vms-rollback—see the API reference.