Skip to content
DocsAll docs
Console

Volumes

Show the volumes that hold the saved storage of your workspaces and environments, and delete a volume you do not need.

Last updated

On this page

Description and operation

General

A volume is the saved storage of one workspace or one environment. It holds the disk of the source and the chain of snapshots taken of that disk. The volume field of a workspace or an environment names its volume.

A volume stays after its workspace or environment is deleted, while it holds a snapshot. The volume is then detached. You can still restore a workspace from a detached volume. When a volume has no working copy and no snapshot, the platform deletes it.

The snapshots of a volume form its lineage. Each snapshot names the snapshot that came before it. The lineage shows newest first:

text
backend-base@3 ← backend-base@2 ← backend-base@1      tip (main) = backend-base@3

You take a snapshot to add one to the lineage. A restore starts a working copy at a past snapshot of the lineage.

A clone is not a volume. A clone of a workspace is a second working copy on the volume of its source. A clone of the live state of an environment gets its own new volume with no snapshots.

FieldDescription
idThe id of the volume. History, refs and a delete by id take it.
nameThe name that the first push gave the volume, or null for a volume that was never named.
latest_versionThe highest version number, or null for a volume that was never named.
kindworkspace or environment.
volumeThe same as id.
display_nameThe name of the workspace or the environment. After it is deleted, the name that its newest snapshot recorded.
deletedtrue when no workspace or environment uses the volume: it is detached.
snapshotsThe number of snapshots, without the snapshots in error.
last_push_atThe time when the newest snapshot became ready.
latest_msThe approximate time of the newest copy on the volume, in epoch milliseconds. Sync points are included.
usedBytes, usedAtThe disk in use, and the time of that measurement. The number is not live.
quotaGbThe size limit of the volume.

The list shows only volumes with at least one snapshot that is not in error. It takes the filters kind and owner. owner is you or a team that you belong to.

Names and versions

A volume gets a name on its first push. A name has 1 to 40 characters of a-z, 0-9 and -. It starts with a letter and ends with a letter or a digit. A name cannot start with ws-, env-, sbx-, bench-, bld- or ci-. The words history, refs, snapshots and versions are reserved.

The name is unique among the volumes of one owner, a user or a team. A name stays with its volume until the volume is deleted. There is no rename.

Each push of a named volume is a version, numbered 1, 2, 3 and so on. A number is never reused, and a deleted version leaves a gap. Pushes of a clone or a restore continue the numbers of the volume that they share. A version has the same lifetime as a push.

A reference selects a version. go-base is the highest numbered ready version, and go-base@3 is version 3. A snapshot id is also a reference. Restore, clone, sandbox from_snapshot and pipeline fromSnapshot take a reference.

A reference reads only the volumes of one owner. A volume of another owner is never restored, cloned or started into your owner, by name or by id. The call answers 404. To restore the volume of a team, give the team to the call. In the restore of a workspace the field is team.

An existing volume with no name keeps working by its id. Its next push must name it. Its old pushes have no number, and the first numbered push is version 1.

Owner and quota

A volume belongs to the owner of its workspace or environment. Its disk counts under diskGb against the quota of the owner, also when it is detached. To release that disk, delete snapshots or the detached volume.

Delete rules

A delete of a volume removes all its snapshots. It is refused while a workspace or an environment uses the volume. It is also refused when the volume holds a snapshot of another owner.

A delete is also refused while a pipeline reads the volume or a version. A pipeline reads a volume when its latest version names it in fromSnapshot. A queued or running run reads it from its own version. The refusal names the readers.

A saveTo alone does not block a delete. The next run makes the volume again. When you delete the last snapshot of a detached volume, the volume is deleted and its name is free.

To do these tasks with an AI agent, see Agentic workflows – Volumes.

Tasks

Show the volumes

Reason for the task: Find the volumes that hold your snapshots, and which of them are detached.

Job set-up

Procedure

  1. Show the volumes. Use kind and owner to filter the list.

    Python
    for v in kl.volumes.list(kind="environment", owner="acme"):    print(v["id"], v["name"], v["latest_version"], v["display_name"], v["deleted"], v["snapshots"], v["last_push_at"])
    TypeScript
    const volumes = (await kl.volumes.list({ kind: "environment", owner: "acme" })) as Record<string, unknown>[];for (const v of volumes) {  console.log(v.id, v.name, v.latest_version, v.display_name, v.deleted, v.snapshots, v.last_push_at);}
    Go
    volumes, err := kl.Volumes.List(kloudlite.ListVolumes{Kind: "environment", Owner: "acme"})if err != nil {    log.Fatal(err)}for _, v := range volumes {    fmt.Println(v["id"], v["name"], v["latest_version"], v["display_name"], v["deleted"], v["snapshots"], v["last_push_at"])}
    Ruby
    kl.volumes.list(kind: "environment", owner: "acme").each do |v|  puts v.values_at("id", "name", "latest_version", "display_name", "deleted", "snapshots", "last_push_at").join(" ")end
    Java
    // The SDK returns the answer as raw JSON. Read the fields with your own JSON library.String volumes = kl.volumes().list(new Kloudlite.ListVolumes().kind("environment").owner("acme"));System.out.println(volumes);
    CLI
    kloudlite volumes list --kind environment --owner acme
  2. Show one volume by its name.

    Python
    print(kl.volumes.get(owner="acme", name="go-base"))
    TypeScript
    console.log(await kl.volumes.get({ owner: "acme", name: "go-base" }));
    Go
    v, err := kl.Volumes.Get("acme", "go-base")if err != nil {    log.Fatal(err)}fmt.Println(v)
    Ruby
    puts kl.volumes.get(owner: "acme", name: "go-base")
    Java
    System.out.println(kl.volumes().get("acme", "go-base"));
    CLI
    kloudlite volumes get acme/go-base

Close-out

  1. Write down the name of the volume, or its id when name is null. Where deleted is true, the volume is detached.

Delete a volume

Reason for the task: Remove a detached volume and all its snapshots to free disk.

Job set-up

WARNING

The platform deletes the volume and all its snapshots at once. You cannot restore from them afterwards.

Procedure

  1. Delete the volume by owner and name, or by id when it has no name.

    Python
    kl.volumes.delete(owner="acme", name="stack-data")# no name: kl.volumes.delete_by_id(volume="env-1f2e3d4c5b6a7988")
    TypeScript
    await kl.volumes.delete({ owner: "acme", name: "stack-data" });// no name: await kl.volumes.deleteById({ volume: "env-1f2e3d4c5b6a7988" });
    Go
    if err := kl.Volumes.Delete("acme", "stack-data"); err != nil {    log.Fatal(err)}
    Ruby
    kl.volumes.delete(owner: "acme", name: "stack-data")# no name: kl.volumes.delete_by_id(volume: "env-1f2e3d4c5b6a7988")
    Java
    kl.volumes().delete("acme", "stack-data");// no name: kl.volumes().deleteById("env-1f2e3d4c5b6a7988");
    CLI
    kloudlite volumes delete acme/stack-data

Close-out

  1. Show the volumes as in task 001. Make sure that the name is gone.

Troubleshooting

SymptomPossible causeCorrective action
The list does not show a volume that you expectThe volume holds no snapshot, or belongs to another owner.Take a snapshot, or use the owner filter.
404 with not foundThe volume does not exist or is not yours.Use an id from the list.
404 with volume go-base does not existThe owner has no volume with this name. A volume of another owner gives the same answer.Use a name from the list, with the right owner.
409 with the volume still has a workspace or environmentA workspace or an environment uses the volume.Delete it, or delete a snapshot instead.
409 with this volume also holds snapshots owned by someone else; delete your own snapshots insteadAnother owner has a snapshot on the volume.Delete your own snapshots.
409 with volume go-base is used by pipeline buildA pipeline or a run reads the volume.Remove the fromSnapshot in a new version of the pipeline, delete the pipeline, or wait for the run.
503 with pipelines cannot be read right now; retryThe platform cannot check the readers. Nothing is deleted.Wait, then delete again.
503 with the cluster could not be reachedThe platform cannot check what uses the volume. Nothing is deleted.Wait, then delete again.
403 or 404 when you list with ownerowner is outside your teams.Use your own handle or a team that you belong to.