Expand description
Block-level copy-on-write for sandbox rootfs via dm-snapshot.
Instead of copying the full rootfs ext4 image for every sandbox,
CowManager creates a dm-snapshot backed by a sparse COW file.
The template image is shared read-only across all sandboxes that
use the same rootfs; only written blocks consume disk space.
Requires CONFIG_DM_SNAPSHOT=y in the kernel, a dmsetup binary at one
of CowOptions::dmsetup_candidates, and loop-device tooling supplied
through the BlockTools seam (BusyboxBlockTools is the reference:
the System VM’s busybox applets; UtilLinuxBlockTools is the stock
distro’s /sbin userland). PATH is never searched — neither the
guest nor a node agent has a meaningful one, so both implementations
take absolute paths.
Structs§
- Busybox
Block Tools BlockToolsover busybox applets — the System VM’s userland.- CowHandle
- Per-sandbox CoW state. Stored in
SandboxInstancefor cleanup. - CowManager
- Manages template loop devices and per-sandbox dm-snapshot lifecycle.
- CowOptions
- What a
CowManagerneeds from its environment. - Util
Linux Block Tools BlockToolsover util-linux, the block tooling a stock distro ships.
Constants§
- COW_
FILE_ PREFIX - File-name prefix of a sandbox’s copy-on-write overlay, under
cow_dir. - COW_
FILE_ SUFFIX - File-name suffix of a sandbox’s copy-on-write overlay. Optional when
reading one back:
reconcile_staleaccepts a name without it. - DM_
NAME_ PREFIX - Device-mapper name prefix for sandbox snapshots.
Traits§
- Block
Tools - Loop-device and block-size operations, supplied by the composer.
Functions§
- device_
major_ minor - The
(major, minor)device numbers of the block device atpath. - mknod_
blkdev - Create a block device node at
node_pathfor(major, minor), mode 0600.