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:
| Failure | Reason | Workaround |
|---|---|---|
-3608 invalid snapshot name | The name contains characters other than Latin letters, digits, and underscores, or exceeds 128 characters | Rename the snapshot |
-3622 configuration version below 4 | VMs with configuration version three do not support snapshots | Upgrade the VM configuration version |
-3625 VM pool does not accept data | The pool is not operational | Wait for the pool to become operational again |
-3630 VM is locked | Another operation is in progress | Retry after it finishes |
-3620 VM not found within visibility scope | No access, or the VM does not exist | Check permissions and that the correct VM is open |
-403 insufficient privileges | The VDC role has fewer permissions than role_id ≤ 2 | Request 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
-
Stop the VM. Rolling back a running VM is rejected with error
-4225. -
In the Snapshots section of the VM card, start rollback to the required snapshot.
-
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
| Failure | Reason | Workaround |
|---|---|---|
-4225 VM must be stopped | The VM is running or suspended | Stop the VM |
-4221 snapshot does not exist | The name does not match the saved name | Use the name from the Snapshots section |
-4224 configuration version below 4 | Rollback is unavailable for VMs with configuration version three | Upgrade the VM configuration version |
-4233 VM pool does not accept data | The pool is not operational | Wait for the pool to return |
-4230 VM is locked | Another operation is in progress | Retry later |
-4208 invalid snapshot name | The name fails format validation | Check the name |
-403 insufficient privileges | The role has fewer permissions than role_id ≤ 2 | Request 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
- How to migrate and clone a VM — cloning and its relationship to snapshots
- Snapshots take up space — troubleshooting growing snapshot space usage
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.