kvbox.cloud
Guides

Snapshots

Freeze a running box and start warm clones from it.

A snapshot freezes a running box at one instant: memory, CPU state and disk. The box keeps running (it is paused for about a second) and the snapshot is a complete, restartable image: a box started from it picks up exactly there, with every process still running. A volume attached to the box is not in it: the new box comes up without one.

kvbox snapshots new <box> <name>   # freeze a running box into a snapshot
kvbox snapshots new <box> <name> --replace   # retake it under the same name
kvbox snapshots ls                 # name, source box, size on disk
kvbox snapshots rm <name>          # delete one (boxes made from it are not affected)
kvbox new --from <name>            # start a warm clone: up in well under a second

Refreshing a snapshot

A snapshot you clone from is often refreshed: install a package in the source box, then take it again. --replace does that in one step. The new snapshot is taken first and swaps in only once it is complete, so the name always points at a whole snapshot: if the new one fails, the old one is untouched, and a clone started meanwhile gets one or the other, never half of each. Without --replace, a name that exists is refused, so a typo never overwrites a snapshot. Boxes already cloned from the old one keep running as they are.

What a snapshot costs

A snapshot only holds what the box touched: the memory pages the guest wrote and the blocks it changed on disk, a few hundred MB for a fresh box, not the box's 4 GB of RAM plus 8 GB of disk. Snapshots of the same box are taken incrementally (only what changed since the last one is read out of the VM, which is why the pause is short) and merged on the host into standalone images, so deleting an older snapshot never breaks a newer one.

Clones

A clone made with --from is the snapshot brought back to life under a new name and IP: the memory is mapped straight from the snapshot file and the disk is a sparse copy, so it takes about 0.3 s and the box is already up. The box itself still remembers the old name and address, so kvbox tells it who it is now through kvbox-agent, a small service in the image reached over vsock (a direct host-to-guest channel, no network involved), before plugging its network in. The source box and its clones run side by side.

Through a control plane a clone lands on the host that holds the snapshot's files.

Forks

kvbox vm fork is a clone in one step, without keeping a snapshot:

kvbox vm fork <box> [name]          # a copy of <box>, on the same host
kvbox vm fork <box> --org acme      # the copy goes to org acme (how a box moves into an org)

A running box is copied warm, exactly like a snapshot plus new --from: the copy carries on with every process where it was, under its own name and IP, and the source is paused for about a second. A stopped box is copied cold: its disk, then a fresh boot (--size then picks the copy's size; the disk can only grow). A hibernated box is refused: wake it first. The copy keeps the source's size and auto-hibernate setting; published ports and HTTPS names stay with the source.

Through a control plane the copy lands on the source's host. When that host is full the fork is refused rather than moved.

A warm pool

The pattern snapshots are for: boot one box, install everything, start the services, snapshot it. From then on every kvbox new --from is a ready environment in under a second, for a test run, an agent, or a preview.

On this page