Take and roll back instance snapshots
Save an instance's disk, and optionally its memory, as a snapshot you can roll back to on the same instance.
In the dashboard
A snapshot saves the state of an instance's disk at one moment, so you can return the disk to that state later. Take one before a risky change, such as an upgrade, and roll back if the change goes wrong. An instance can hold 8 snapshots at a time.
A snapshot lives on the same storage as the instance's disk. It is quick to take and to roll back to, but it goes with the disk. A rebuild or a cancellation deletes it, and restoring a backup leaves it unusable. For a copy that survives a rebuild, create a backup.
Before you begin
Section titled Before you begin- The instance is not suspended.
- To include the memory, the instance is running.
Take a snapshot
Section titled Take a snapshot- In the dashboard, go to Cloud Compute, open the instance and select the Snapshots tab.
- Select Take snapshot….
- Under Name, type a name such as
before-upgrade. Start with a letter, and use letters, digits, hyphens and underscores. Keep it to 37 characters or fewer: the form accepts 40, but a longer name fails when we take the snapshot. - Optionally, add a Description of up to 255 characters.
- To save the memory as well, tick Include memory (RAM state). Rolling back to the snapshot then resumes the instance exactly where it was. The snapshot is larger, and the instance pauses while we save its memory.
- Select Take snapshot.
The snapshot appears in the table with its Contents, Disk or Disk and memory, and when it was Taken.
Roll back to a snapshot
Section titled Roll back to a snapshotRolling back returns the disk to the snapshot and loses everything written to it since.
- On the Snapshots tab, open the menu at the end of the snapshot's row and select Roll back….
- Type the snapshot's name to confirm, then select Roll back.
We shut the instance down, roll the disk back and start it again. A snapshot with memory resumes from its saved state. The snapshot stays, so you can roll back to it again later.
Tip
Take a fresh snapshot before you roll back if you might need the current state.
Delete a snapshot
Section titled Delete a snapshot- On the Snapshots tab, open the menu at the end of the snapshot's row and select Delete snapshot….
- Type the snapshot's name to confirm, then select Delete snapshot.
Deleting a snapshot frees its space on the storage. The instance itself does not change.
Result
Section titled ResultThe table lists each snapshot with its status, and the card above it counts how many of the 8 you use. A snapshot that failed does not count.
Troubleshooting
Section titled TroubleshootingSnapshot limit reached- The instance holds 8 snapshots. Delete one before you take another.
Snapshot name must be alphanumeric (start with a letter), max 40 chars- The name has a character a snapshot name cannot hold, or does not start with a letter. Use letters, digits, hyphens and underscores only.
Snapshot failed- The host could not take the snapshot. A name longer than 37 characters is one cause. Choose a shorter name and try again.
Rollback failedafter you rolled back a snapshot with memory- The instance may have rolled back anyway. Open the Console tab and check its state before you try again.
Rollback failedorDelete snapshot failedafter a rebuild or a restore- The rebuild or the backup restore replaced the disk the snapshot belonged to, and the snapshot can no longer be used. If a rollback stopped the instance, start it again from the header.
Related
Section titled Related- Back up and restore an instance for copies kept on separate storage.
- Rebuild an instance explains what a rebuild erases.
- Cloud Compute limits lists the snapshot limit with the others.
With the API
Section titled With the APIGET /api/v1/client/vps/{uuid}/snapshots lists the instance's snapshots, newest first. Each has an id, name, description, vmstate (1 when it holds memory), status and created_at. status is creating, ready, rolling_back, deleting or failed.
POST /api/v1/client/vps/{uuid}/snapshots takes a snapshot. Send name; description and vmstate are optional, and vmstate is false when left out. The request returns when the snapshot is ready.
curl -X POST https://api.coritan.com/api/v1/client/vps/$INSTANCE_UUID/snapshots \
-H "Authorization: Bearer $CORITAN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "before-upgrade", "description": "Before the kernel upgrade", "vmstate": false}'
{"id": 3, "name": "before-upgrade", "proxmox_snapname": "cc-before-upgrade", "status": "ready"}
A ninth snapshot answers 409 with Snapshot limit of 8 reached. A name the rules refuse answers 400, and so does a snapshot the host could not take, with a message that starts Snapshot failed.
POST /api/v1/client/vps/{uuid}/snapshots/{snapshot_id}/rollback rolls back to a snapshot whose status is ready, and answers {"status": "rolled_back", "id": 3} once the instance runs again. Any other snapshot answers 404 with Snapshot not found or not ready.
DELETE /api/v1/client/vps/{uuid}/snapshots/{snapshot_id} deletes a snapshot and answers {"status": "deleted", "id": 3}. You can delete snapshots while the instance is suspended.
Taking a snapshot and rolling back answer 403 with Instance is suspended on a suspended instance. While we move the instance to another host, taking, rolling back and deleting answer 409 with Instance is migrating.
API operations on this page
| Method | Path | What it does |
|---|---|---|
GET | /api/v1/client/vps/{uuid}/snapshots | List snapshots |
POST | /api/v1/client/vps/{uuid}/snapshots | Create snapshot |
DELETE | /api/v1/client/vps/{uuid}/snapshots/{snapshot_id} | Delete snapshot |
POST | /api/v1/client/vps/{uuid}/snapshots/{snapshot_id}/rollback | Rollback snapshot |