kvbox.cloud
Guides

Volumes

Disks of their own, attached to a box at /mnt/<name> and kept when the box goes.

A volume is a disk created apart from any box. Attach it to a box and it appears at /mnt/<name>, formatted and ready; detach it and attach it to another box later, with everything on it. A box's own disk goes when the box is destroyed; a volume does not.

kvbox volume create data --size 50GB --box dev   # an empty 50 GB disk, made where box dev lives and attached to it
kvbox volume attach data dev                     # /mnt/data inside box dev
kvbox volume ls                                  # size, what it occupies, which box has it
kvbox volume detach data dev                     # the data stays on the volume
kvbox volume grow data 100GB                     # a larger disk; it never shrinks
kvbox volume rm data                             # delete it and everything on it (detach first)

A volume only occupies what is written to it, so a 500 GB volume with 3 GB of files costs the host 3 GB. Sizes are whole GB, up to 4096.

Price

A volume costs $1 per month plus $0.06 per GB per month of its size, by the hour, whether a box has it or not and whatever it holds: the size is a reservation of the host's disk. A 50 GB volume is $4 a month. A box's own disk is free up to 8 GB and $0.06 per GB per month above that, so growing it with kvbox vm rescale --disk costs the same per GB as a volume. kvbox usage lists your volumes under your boxes with their hours and cost; the total under it covers both.

Attaching restarts a running box

A microVM takes its disks at boot. Attaching or detaching a volume on a running box shuts it down cleanly and starts it again, which takes a few seconds; the command says so. A stopped box just takes the change and mounts the volume when it next starts. A hibernated box is refused: wake it first.

A volume attaches to one box at a time. ext4 is a single-machine filesystem, and two boxes writing the same disk would corrupt it. Detach it from one box before attaching it to another; the move is instant, the data never leaves the host.

Growing a volume

kvbox volume grow data 100GB makes the volume larger, to the size given; the files on it stay. A volume never shrinks. Its filesystem is resized while nothing has it mounted, so a running box holding it is restarted once, like an attach; a detached volume or one on a stopped box just grows. The larger size is what is charged from then on.

Backups

kvbox volume backup create data copies the volume to the kvbox cloud, encrypted, and kvbox volume backup restore data <id> puts it back; see Backups. A box's own backup does not include its volumes.

Snapshots and forks

A snapshot captures the box, never its volumes. A box started from a snapshot, or forked from a box, comes up without a volume: its memory still has the mount from the source box, and kvbox drops that mount right after the restore, so a program reaching for /mnt/<name> gets a plain error instead of a dead filesystem. Attach a volume to the new box when it needs one. Taking the snapshot does nothing to the source box or its volume.

Where a volume lives

A volume is a file on one host, next to the boxes, and attaches only to a box on that host. On kvbox.sh your boxes may be on different hosts, so a volume is always created for a box: --box dev makes it on the host that runs dev and attaches it there right away (a running box restarts). --box is required on kvbox.sh; on your own host (--local) it is optional, there is only one host. Attaching a volume to a box on another host is refused with both hosts named. A host sells only the disk its boxes do not need, so a create can be refused when the hosts are full. kvbox volume ls --json shows every field, including which box holds it. Volumes need base image v0.9.1 or later on the host (install-server.sh brings it).

On this page