Skip to content

Snapshots and forks

A snapshot captures the writable disk of one VM. It keeps files and their contents, not memory or running programs, and the VM keeps running while the capture is made. A snapshot stays in the project of its VM: a VM create that names a snapshot of another project answers 404 snapshot_not_found.

A fork captures a running VM and starts a new VM from that disk in one step.

A capture starts at once and answers with state creating; the VM keeps running, and a sleeping VM is captured without waking. The snapshot turns ready when the capture finishes, or failed if it does not complete. Without a name it is <VM name or id>-YYYYMMDD-HHMMSS, cut to 32 characters. The samples use a VM named app with v1 in /home/user/note.txt; si create --name app creates it, and si exec app -- sh -c 'echo v1 > /home/user/note.txt' writes the file.

  1. Open SVMs and select app.
  2. Select More actions, then Snapshot.
  3. Enter before-upgrade in Name.
  4. Select Create snapshot. The Snapshots tab of app lists it as creating, then ready.

List returns every snapshot of one project, newest first. used_by names the VMs that read each snapshot, including asleep and deleting ones, and a snapshot with an entry there cannot be deleted. The CLI table shows the source VM, the stored size and the used-by list.

  1. Open Snapshots. The table lists every snapshot of the active project with Name, Created, Size, Source, State and Used by.

Get returns one snapshot. A name resolves in the project query, default when omitted; an id resolves in every project of the organization. logical_bytes is the used part of the disk and stored_bytes the compressed bytes the capture uploaded; a chunk the shared store already held counts 0, so stored_bytes is not the current storage cost. Both are 0 while the state is creating. The CLI and dashboard have no single-snapshot view.

Terminal window
curl -sS "https://api.slashinfra.com/snapshots/before-upgrade" \
-H "Authorization: Bearer $SI_API_KEY"
Output
{"id":"0zs0pshr3x","project":"proj_6f1c0f0e8a","name":"before-upgrade","state":"ready","kind":"user","error":null,"source":"6f1c0f0e8a","created_ms":1795958251456,"expires_ms":null,"logical_bytes":1544192,"stored_bytes":10014,"used_by":[]}

Rename changes the name and keeps the id, disk, state, kind, source and expiry. The new name follows the VM name rules and is unique in the project; a name another snapshot of the project has answers 409 name_taken. A VM started from the snapshot keeps reading it.

  1. Open Snapshots.
  2. Select the pencil icon (Rename before-upgrade) on the row.
  3. Enter app-before-upgrade in New name for before-upgrade.
  4. Select the check icon (Save the name of before-upgrade).

A VM create names the snapshot with snapshot (--snapshot), by name in the new VM’s project or by id. The disk starts from the snapshot; memory and running programs do not, so start your services yourself. A creating snapshot is accepted, and the first request waits for the capture. The memory of the new VM is 2048, 4096, 8192 or 16384 MiB.

  1. Open Snapshots.
  2. Select Start SVM on the app-before-upgrade row.
  3. Enter app-restored in Name.
  4. Select Create SVM.

app-restored has v1 in /home/user/note.txt. Nothing that ran on app is running.

A fork takes a snapshot of a VM and starts a new VM from it in one step. The create names the source with fork_of (--fork), and fork_of excludes snapshot. The capture is a fork snapshot named fork-of-<source>-<time>, which does not count against the plan quota and is deleted with the last VM that reads it. The fork does not stop or wake the source VM.

  1. Open SVMs and select app.
  2. Select More actions, then Fork.
  3. Enter app-fork in Name.
  4. Select Fork SVM.

app-fork has v1 in /home/user/note.txt. Its capture appears in si snapshot ls as fork-of-app-<time> with state ready and app-fork in used_by.

A snapshot that a VM reads cannot be deleted: the API answers 409 snapshot_in_use and lists the VMs in used_by. app-restored reads app-before-upgrade, so delete it first with si rm app-restored or the VMs page, and wait until it is gone. Delete removes the snapshot and its cold objects, and the source VM app keeps its disk.

  1. Open Snapshots.
  2. Select More actions on the app-before-upgrade row.
  3. Select Delete. The row stays for five seconds; select Undo to keep the snapshot.

The VMs app and app-fork remain. Delete them with si rm when you are done; deleting a VM does not delete a user snapshot, and the fork snapshot goes with app-fork.

Field Type Default Allowed values What it changes
name (--name on create) string Create: <VM name or id>-YYYYMMDD-HHMMSS; rename: Required 1 to 32 lowercase letters, digits or hyphens, starting with a letter; unique in the project The snapshot name. A rename changes only the name.
ttl_s number None, the snapshot lives until deleted Whole seconds from 1 to 2592000 (30 days) The life of the snapshot. The minute cron deletes it at expires_ms unless a VM reads it. API only.
project (--project) string default A project name, or its proj_ id The project of the snapshot. A query on snapshot operations and a body field on a VM create.
snapshot (--snapshot) string None A snapshot name in the new VM’s project, or its id The disk to start from. A creating snapshot is accepted. Excludes fork_of.
fork_of (--fork) string None A VM name in the new VM’s project, or its id Captures that VM’s disk and starts the new VM from it. Excludes snapshot.
ref (path) string Required A snapshot name in the project query, or its id The snapshot that get, rename and delete act on.

Scroll horizontally to see all columns.

si snapshot create has no --ttl flag, and the CLI has no command to get one snapshot; use the API for both. The other fields of a VM create, such as memory_mib and tier, are on VMs.

State or kind What it means for you What you can do
creating The capture is running; logical_bytes and stored_bytes are 0. Start a VM from it, or wait for ready.
ready The capture is complete and the sizes are set. Start VMs, rename it, or delete it when used_by is empty.
failed The capture did not finish; error holds the catalog code. Take a new snapshot; a VM create that names it answers 409 snapshot_failed.
kind: user Made by a snapshot create. Counts against the plan’s 50 or 200. Read, rename or delete it.
kind: fork Made by a fork_of create, named fork-of-<source>-<time>. Does not count against the plan. Read it; it is deleted with the last VM that reads it.
kind: backup Made by a schedule’s snapshot action. Does not count against the plan. Read it; the schedule’s keep retention deletes older ones.

Scroll horizontally to see all columns.

Code When Fix
invalid_name Create or rename sends a name outside the rule in Options. Start with a letter, use 1 to 32 lowercase letters, digits or hyphens.
name_taken Create or rename uses a name another snapshot of the project has. Choose another name.
invalid_ttl Create sends a lifetime outside 1 to 2592000 seconds. Send a whole number of seconds from 1 to 2592000.
snapshot_limit Create would exceed the plan’s count of user snapshots. Delete a snapshot, or ask about your plan.
snapshot_not_found Get, rename, delete or a VM create names no snapshot the key can see, or one of another project. Check the name or id and the project.
snapshot_in_use Delete names a snapshot that a VM reads, including an asleep VM. Delete the VMs in used_by first.
snapshot_failed The capture failed, or a VM create names a failed snapshot. Take a new snapshot.
snapshot_pending The first request reaches a VM whose starting snapshot is still creating. Wait for Retry-After; the VM starts when the capture is ready.
invalid_snapshot A VM create sends both snapshot and fork_of, or a malformed reference. Send exactly one of them.
svm_not_found Create or fork names no VM in the project. Check the VM name or id and the project.
deleting Create or fork names a VM that is being deleted. Wait for the delete to finish.
project_not_found The project query or body names no project of the organization, or one outside the key’s scope. Check the name or id, and the key’s project scope.
no_capacity Delete cannot reach the storage that holds the snapshot. Wait for Retry-After and retry.
svm_unreachable The storage does not answer the delete. Wait for Retry-After and retry.

Scroll horizontally to see all columns.

Errors that any request can return are in the error catalog.

Operation Who can Key action
Take a snapshot Any member snapshot:write
List snapshots Any member snapshot:read
Get a snapshot Any member snapshot:read
Rename a snapshot Any member snapshot:write
Start a VM from a snapshot Any member svm:write
Fork a VM Any member svm:write
Delete a snapshot Any member snapshot:delete

Scroll horizontally to see all columns.

  • A snapshot name has 1 to 32 lowercase letters, digits or hyphens and starts with a letter. Without one, the name is <VM name or id>-YYYYMMDD-HHMMSS, cut to 32 characters.
  • ttl_s is 1 to 2592000 seconds (30 days). The minute cron deletes the snapshot at expires_ms, unless a VM reads it.
  • Standard allows 50 user snapshots and Pro allows 200; fork and backup snapshots do not count. A snapshot create that answers 409 snapshot_limit creates nothing.
  • A snapshot holds at most 50 GiB of disk; logical_bytes counts the used part.
  • A snapshot that any VM reads (listed in used_by) cannot be deleted.
  • A fork snapshot is deleted with the last VM that reads it; a minute sweep removes one that no VM reads and is older than 10 minutes.
  • stored_bytes counts the compressed bytes uploaded at capture; a chunk the shared store already held counts 0, so it is not the current storage cost.

The full list is in Limits.

  • VMs: create a VM, choose its size, and delete the VMs that read a snapshot.
  • Schedules: take backup snapshots on a cron.
  • Control API snapshots: every operation, field and status code.