Skip to main content

Module snapshot_cow

Module snapshot_cow 

Source
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§

BusyboxBlockTools
BlockTools over busybox applets — the System VM’s userland.
CowHandle
Per-sandbox CoW state. Stored in SandboxInstance for cleanup.
CowManager
Manages template loop devices and per-sandbox dm-snapshot lifecycle.
CowOptions
What a CowManager needs from its environment.
UtilLinuxBlockTools
BlockTools over 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_stale accepts a name without it.
DM_NAME_PREFIX
Device-mapper name prefix for sandbox snapshots.

Traits§

BlockTools
Loop-device and block-size operations, supplied by the composer.

Functions§

device_major_minor
The (major, minor) device numbers of the block device at path.
mknod_blkdev
Create a block device node at node_path for (major, minor), mode 0600.