Volumes, export, and restore
A VolumeA persistent volume that exists independently of any Workspace. A Workspace binds at most one Volume, mounted at /data by default. stores a Workspace's data and exists independently of any Workspace. This page shows how to choose a Volume when you create a Workspace, create and resize Volumes, rebind them, and export a Workspace's data to restore it as a new Workspace.
Volumes at creation
By default each Workspace gets a new Volume mounted at /data and marked for deletion with the Workspace. Only this path is guaranteed to keep data across stop and start.
Create a Volume ahead of time and bind it at another path when you create the Workspace:
volume_id=$(kibo volume create --capacity 10G -q)
kibo workspace create --template "$template_id" --volume "$volume_id" --mount-path /srv/dataThe Volume parameters of kibo workspace create:
| Parameter | Effect |
|---|---|
| Omitted | Create a new Volume mounted at /data and delete it along with the Workspace |
--mount-path <path> | Change the mount path |
--volume <id> | Bind an existing Volume. By default, deleting the Workspace only unbinds the Volume and does not delete it |
--delete-with-workspace[=false] | Decide explicitly whether deleting the Workspace also deletes the Volume. New Volumes are deleted by default; --volume keeps the Volume by default |
--no-volume | Bind no Volume. Such a Workspace has no path guaranteed to persist |
--volumeand--no-volumeare mutually exclusive.--no-volumealso excludes--mount-pathand--delete-with-workspace.- Conflicts and invalid paths are rejected before the request is sent.
- To create a Volume ahead of time, use
kibo volume createorkibo transfer import.
"Delete with the Workspace" is a property of the binding, not a kind of Volume. After the Workspace stops, you can rebind, change the path, flip this setting, or unbind. See Binding, rebinding, and unbinding Volumes.
Managing Volumes
kibo volume create, resize, and delete complete within the request, and the output shows the resulting state. If the result is lost, query it by command ID. See Unknown results.
Creating a Volume
Create a Volume that belongs to no Workspace:
kibo volume create --capacity 10G- Without
--capacity, the capacity is set by the node's storage configuration. --capacitytakes a binary size such as10Gor512MiB.GBandMBare rejected; useGorGiB. These, non-positive values, and values that cannot be parsed are rejected before the request is sent. See Size and CPU formats.- Without
--command-id,kibogenerates one and returns it in thecommand_idof the output. - Bind the Volume afterwards with
kibo workspace create --volumeorkibo workspace volume bind. Deleting the Workspace only unbinds it by default.
Viewing Volumes
List Volumes, or show one of them:
kibo volume list
kibo volume get "$volume_id"- Both show a Volume's capacity and the Workspace currently bound to it.
- Every Volume has a defined capacity, including Volumes created with a Workspace. When the server returns no capacity, the output shows
unknown. - The list does not show deleted Volumes by default. See Filtering lists.
Resizing a Volume
Stop the Workspace that uses the Volume, then grow the Volume to a total of 20 GiB:
kibo workspace stop "$workspace_id"
kibo volume resize "$volume_id" --capacity 20G--capacityis required. It is the total capacity after resizing and can only grow.- When it equals the current capacity, the command succeeds and does nothing. When it is smaller than the current capacity, the command returns
invalid_argument. - Only an unmounted Volume can be resized. When the Volume is still mounted on a node, or the Workspace it belongs to is running, the command returns
failed_precondition. - During the resize, the Volume state is
RESIZING. The node also grows the file system in the Volume, and the guest can use the new capacity once the Workspace starts again.
Deleting a Volume
Delete a Volume you no longer need:
kibo volume delete "$volume_id"kibo asks for confirmation first, and --yes skips it. Apart from this command, a Volume is deleted only when you delete its Workspace and the binding says to delete it. See Delete.
Unknown results
When the response to a create, delete, or resize is lost, query the result by command ID:
kibo volume command get "$volume_id" "$command_id"The output gives status, error, and the corresponding result. Do not resubmit with a different ID. It works the same way as kibo workspace command get.
Binding, rebinding, and unbinding Volumes
kibo workspace volume bind binds an existing Volume to a stopped Workspace. The target is the complete binding: to switch to another Volume, change only the mount path, or only flip the "delete with Workspace" switch, run this command again with the final values you want.
Warning
Flags you leave out take their defaults: --mount-path falls back to /data, and leaving out --delete-with-workspace turns deletion with the Workspace off. Rebinding the Volume a Workspace was created with, only to change its mount path, therefore also makes that Volume outlive the Workspace unless you pass --delete-with-workspace.
Bind a new Volume at /srv/data and start the Workspace with it:
workspace_id=workspace-example
volume_id=$(kibo volume create --capacity 10G -q)
kibo workspace stop "$workspace_id"
kibo workspace volume bind "$workspace_id" --volume "$volume_id" --mount-path /srv/data
kibo workspace start "$workspace_id"Remove the binding of a stopped Workspace:
kibo workspace volume unbind "$workspace_id"Parameter of bind | Effect |
|---|---|
--volume | The Volume to bind. Required |
--mount-path | The mount path in the guest. The default is /data |
--delete-with-workspace | Delete the Volume when the Workspace is deleted. Without it, the Volume is kept |
--expected-revision, --command-id | See Binding revision |
Requirements
- The prerequisites are the same as for Adjusting resources: the Workspace must not hold an execution. While it is running, the command returns
failed_precondition. Runkibo workspace stopfirst. - The target Volume must exist, be
AVAILABLE, not be bound by another Workspace that is not deleted, and be in a storage pool that the node where this Workspace is currently placed can access. Otherwise the command returnsnot_foundorfailed_preconditionrespectively, and the binding does not change.
Effects of a binding change
- A Volume that is replaced or unbound is not deleted. It returns to
AVAILABLEwith its data intact, and you can bind it to another Workspace or delete it explicitly withkibo volume delete. This does not depend on its switch; the switch only decides whatkibo workspace deletedoes. - The new binding is mounted at the next
kibo workspace start. - An unbound Workspace has no guaranteed persistent path, so you cannot run
kibo transfer exporton it. - After you change the path, the old mount point stays in the writable layer as an ordinary directory.
Binding revision
The command uses optimistic locking with the revision binding_revision, shown as Volume binding in the Revisions section of workspace get --wide.
- Without
--expected-revision,kiboreads the current revision first and then submits. - If the revision changed by the time of submission, the command returns
abortedand does not retry automatically. - When a script needs to replay, pass
--command-idand--expected-revisiontogether. - Submitting a binding identical to the current one does not change the revision. This revision is independent of the resources revision used by
update.
Export, import, and restore
A TransferAn export of the Volume of a stopped Workspace to an archive. You can import the archive as a new Volume and restore it as a new Workspace. copies the Volume contents of a stopped Workspace into a new Volume, then creates a new Workspace from it. It has three steps. Once ctrl accepts a step, ctrl carries it out to the end on its own and retries by itself when ctrl restarts or a node is briefly unreachable.
Export a stopped Workspace, import the archive as a new Volume, and restore a Workspace from it:
kibo transfer export "$workspace_id"
kibo transfer import "$transfer_id"
kibo transfer restore "$transfer_id" --volume "$volume_id" --template "$template_id"| Step | Result |
|---|---|
export | An archive of the Volume's files. The Transfer is COMPLETE |
import | A new Volume with the archived files |
restore | A new Workspace bound to the imported Volume |
Export
exportrequires the Workspace to beSTOPPEDwith a Volume bound.- When it completes, the Transfer is
COMPLETE, and the manifest in the output gives the file count, archive size, SHA-256, and expiration time. - The two directories
.kibotos/credentialsand.kibotos/browser-stateare not exported. - The archive is not compressed, so it is about as large as the files it contains. It is at most 1 GiB by default, and the deployer can change this limit.
- An export whose archive exceeds the limit fails with
resource_exhausted, and the Transfer moves toFAILED. Reduce the data in the Volume, or ask the deployer to raise the limit, then export again.
Import
importcreates a new Volume. By default it lands in the storage pool of the exported Volume;--storage-poolchooses another pool.- The deployment decides which node runs the import, as long as that node is connected to the target pool.
- An import that fails because no node is available or the pool lacks capacity does not consume the Transfer. The Transfer stays
COMPLETE; import again later with a different command ID. - An import that fails on the node moves the Transfer to
FAILED, and you need to export again.
Restore
restorecreates a new Workspace from the imported Volume and the spec you give.--cpu,--memory, and--disktake the same form as inworkspace create.- Sessions, credentials, processes, and sign-in state need to be established again.
Waiting for a Transfer
Exporting and importing a large Volume takes a few minutes. kibo resends with the same command ID until the command completes or --wait-timeout is reached:
| Command | Default --wait-timeout |
|---|---|
export, import | 2 hours |
restore | 1 hour |
Ending the wait or pressing Ctrl-C does not withdraw the command. Run it again with the original --command-id to keep waiting for its result.
Archive retention
Archives are stored in the deployment's artifact store. By default they are kept for 24 hours, and the deployer can change this period. For the size limit, see Export.
- A Transfer not imported before the retention period ends becomes
EXPIRED. After that,importreturnsfailed_precondition, and you need to export again. - Transfers that were already imported or restored are not affected by expiration. The imported Volume and the restored Workspace keep working as usual.
kibo transfer deletedeletes the archive immediately and needs no node to be online. While an export, import, or restore is still in progress, it returnsfailed_precondition.
With the API
Volumes
Volumes are managed with VolumeService. Create, resize, and delete complete within the request, and the response carries the resulting state.
kibo command | API |
|---|---|
kibo volume create | CreateVolume |
kibo volume resize | ResizeVolume. It takes no expected revision |
kibo volume command get | GetVolumeCommand. Use it when the result is unknown |
kibo workspace volume bind | UpdateWorkspaceVolumeBinding |
Transfers
The methods on TransferService are ExportWorkspace, ImportTransfer, RestoreWorkspace, GetTransfer, and DeleteTransfer.
The three write methods wait at most 1 minute for the command to complete. A timeout returns a retryable unavailable and the command keeps running. See Command IDs.
Notes
- The deployer can move a Volume or writable layer to another storage pool with
kibo volume moveandkibo workspace move-layer. See Moving objects between pools. - While a move is in progress, starting a Workspace that owns or binds the object, resizing, binding or unbinding, deleting, and exporting all return a retryable
unavailable(exit code15). Try again after the move settles.
Next steps
- Creating and listing: the other parameters of
kibo workspace create. - Lifecycle: what deleting a Workspace does to its Volume.
- Guarantees and limits: which data is kept in which case.
Network troubleshooting
This page shows how to confirm that changes to the network policy, an Egress, or a Resolver are in effect, and how to tell causes apart when a connection or DNS query fails.
Resources and health
This page shows how to change the CPU, memory, and disk of a Workspace, which task and memory limits apply inside the guest, how to tell whether the guest still responds or is stuck on memory, and how to read resource metrics over time.