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 # an empty 50 GB disk, yours
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 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.
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.
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 the host, next to the boxes, and attaches only to boxes on that host. 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).
For now the volume commands are host side only: they work on a self-hosted server and with kvbox --local. Through kvbox login (api.kvbox.sh) they answer no route until the control plane serves volumes.