group:member, or artifact path.
Guest writeback
SetSnapshotCreateOptions.GuestFlush to msb.GuestFlushRequired, pass msb.WithForkGuestFlush(msb.GuestFlushRequired) to Fork/ForkMany, or call source.PauseWithGuestFlush(ctx, msb.GuestFlushRequired).
The default GuestFlushAuto flushes live disk-only captures, but adds no optional flush to full captures, forks, or pause. GuestFlushSkip retains mandatory storage barriers.
A paused disk capture needs a matching prior flush; cloud rejects non-Auto policies. See guest flush policy reference.
Disk capture, including SandboxHandle.Snapshot, requires a native library that supports guest-flush policies. Older libraries return an upgrade-required error, including for stopped disk captures. Full Auto capture and unrelated operations retain their compatibility.
Snapshot functions
Package-level helpers for snapshot artifacts. Access them through the exportedSnapshot value, e.g. m.Snapshot.Create(ctx, ...).
Snapshot.Create()
Full to include memory and execution state. SnapshotCreateOptions.FromSandbox is required. An empty Name is generated; an empty Group uses the source sandbox’s name.
Parameters
ctxcontext.ContextReturns
Example
Example
Snapshot.CreateArchive()
Example
Example
Snapshot.Open()
Example
Example
group:member, or filesystem path. This validates metadata only; call s.Verify() for content checks.
Parameters
ctxcontext.ContextpathOrNamestringgroup:member selector or artifact directory path.Returns
Snapshot.Get()
Example
Example
group:member, stable snapshot ID, descriptor digest, or artifact path. Global IDs and digests must resolve unambiguously.
Parameters
ctxcontext.ContextnameOrDigeststringgroup:member, stable snapshot ID, digest, or artifact path.Returns
Snapshot.List()
Example
Example
Returns
Snapshot.ListDir()
ErrUnsupportedOperation.
Parameters
ctxcontext.ContextdirstringReturns
Snapshot.Remove()
Example
Example
force is true.
Parameters
ctxcontext.ContextpathOrNamestringgroup:member, or artifact path.forceboolSnapshot.Reindex()
Example
Example
dir and rebuild the local index from the artifacts it finds. Cloud
returns ErrUnsupportedOperation.
Parameters
ctxcontext.ContextdirstringReturns
Snapshot.Save()
.msb archive at outPath. Set SnapshotSaveOptions.PlainTar to skip compression.
Parameters
ctxcontext.ContextnameOrPathstringgroup:member, or artifact path to save.outPathstringExample
Example
Snapshot.Load()
dest directory. Pass "" for the default destination. Cloud returns
ErrUnsupportedOperation.
Parameters
ctxcontext.Contextarchivestringdeststring"" for the default snapshots directory.Returns
Example
Example
Snapshot.LoadWithBase()
Snapshot.LoadWithOptions()
Snapshot.LoadMany()
Snapshot.GroupHead()
group:member. Returns the group, previous and current snapshot IDs, reason, and whether the head changed. See group selection.
Import options
Options forSnapshotLoadOptions.
SandboxHandle methods
Snapshots are taken from a metadata handle returned byGetSandbox. Local disk capture also supports a running or paused sandbox. Cloud requires a stopped persistent source.
h.Snapshot()
sandbox:member to open it later.
Parameters
ctxcontext.ContextnamestringReturns
Example
Example
SnapshotArtifact methods
A local or cloud disk snapshot. The accessors below are plain field reads.s.SaveTo()
ErrUnsupportedOperation.
s.CopyTo()
ErrUnsupportedOperation when Save is called.
s.ID()
snap_... identity.
s.Verify()
Checkpoint.
Returns
Example
Example
s.Reference()
SnapshotArtifact itself to RestoreSandbox so its typed reference is preserved as well.
s.ReferenceKind()
"id" or "path". Most callers can pass the artifact itself and
never inspect this value.
s.Digest()
sha256:...).
s.SizeBytes()
s.ImageRef()
s.ImageManifestDigest()
s.Format()
"raw" or "qcow2".
s.Scope()
SnapshotScopeDisk ("disk") or SnapshotScopeFull ("full").
s.Fstype()
s.Parent()
nil if this snapshot has no parent. Returns a defensive copy.
s.CreatedAt()
s.Labels()
s.SourceSandbox()
nil. Returns a defensive copy.
SnapshotHandle methods
A lightweight handle returned by the active backend. The handle retains a stable reference used byOpen, Remove, and
SaveTo.
h.Open()
Example
Example
Returns
h.Remove()
Example
Example
Parameters
ctxcontext.Contextforceboolh.SaveTo()
ErrUnsupportedOperation.
h.Digest()
h.Name()
nil when no alias is recorded. Returns a defensive copy.
h.ParentDigest()
nil. Returns a defensive copy.
h.ImageRef()
h.Format()
"raw" or "qcow2".
h.Scope()
SnapshotScopeDisk ("disk") or SnapshotScopeFull ("full").
h.SizeBytes()
nil if unknown.
h.ReferenceKind()
"id" or "path" for the handle’s backend-neutral reference.
h.CreatedAt()
Forking
Fork a running or paused local sandbox to create a child with copy-on-write memory. The source returns to its previous state, and each child needs an unused name.SandboxHandle has the same methods. See the forking guide for backend limits and disk bindings.
Fork
Example
Example
ForkMany
Example
Example
Name, plus a started Sandbox or an Error; the other field is nil. Validation or capture errors return for the whole call; a child startup error leaves successful siblings running. Stop and close successful children when finished.
Use WithForkIntegrity() to record disk hashes, WithForkGuestFlush(GuestFlushRequired) to request guest writeback, and WithForkVolumes to rebind captured disks. Forks cannot add new block devices, and batch children cannot share a writable disk image. See fork disk bindings.
The Branch names remain deprecated aliases; use fork option functions in place of the removed ForkOptions and BranchOptions structs.
Restore
Restore into a new detached sandbox. Disk boots fresh; full resumes execution. See restore examples and progress.Example
Example
WithAllowMissingResources() to resume with unavailable devices (full restore records warnings). This is separate from strict/relaxed validation of supplied mappings; inheritance does not waive missing backing. Root and owned storage remain required.
Destination options
Destination options
time.Duration, rounded up to seconds. Binding fields belong in WithRestoreConfig(RestoreConfig{...}); nil pointers mean omitted. Network policy accepts factory results or NetworkConfig with only Rules, DefaultEgress, and DefaultIngress.RestoreConfig.Volumes
WithRestoreConfig().
Example
Example
RestoreConfig.CapturedVolumes
WithRestoreConfig().
WithAllowMissingResources()
Compaction
Compact a local sandbox’s root or owned disks. See compaction for examples and recovery requirements.Options and results
Options and results
GuestPath. MaterializedBytes counts copied bytes, not reclaimed space. Times are microseconds: per-disk TotalUs covers preparation; aggregate TotalUs also includes switching; PauseUs measures the shared VM pause.Constants
Snapshot scopes
Returned by s.Scope() · h.Scope()
Scope of what a snapshot captures: disk-only or disk plus complete VM state.Types
SnapshotArtifactstruct
Returned by Snapshot.Create() · Snapshot.Open() · Snapshot.ListDir() · h.Snapshot() · h.Open()
A backend-neutral snapshot. Fields are unexported; read them through the accessor methods below.SnapshotCopyBuilderstruct
Returned bySnapshotArtifact.CopyTo. Fields are unexported; use
the fluent methods below.
SnapshotHandlestruct
Returned by Snapshot.Get() · Snapshot.List() · Snapshot.Load()
A lightweight handle returned by the active backend. Fields are unexported; read them through the accessor methods below.SnapshotCreateOptionsstruct
Accepted by Snapshot.Create()
ConfiguresSnapshot.Create. FromSandbox is required. An empty Name is generated; an empty Group uses the source sandbox’s name.
Name
string
Member name within its group; generated when empty
Group
string
Destination snapshot group; defaults to the source sandbox’s name
FromSandbox
string
Name of the source sandbox; local disk capture supports running, paused, stopped, and crashed sources. Cloud requires a stopped persistent source
DestDir
string
Parent directory containing snapshot groups; empty = the default snapshots directory
Labels
map[string]string
Arbitrary user labels recorded in the manifest
Force
bool
Overwrite a direct archive output; rejected for installed group members
RecordIntegrity
bool
Record content hashes so Verify can recompute them later
Full
bool
Local-only when true: include memory and execution state from a running or paused source. With false, local disk capture supports running, paused, stopped, or crashed sources. Cloud requires false and a stopped persistent source
GuestFlush
GuestFlush
Guest writeback policy; defaults to GuestFlushAuto. See guest writeback
SnapshotSaveOptionsstruct
Accepted by Snapshot.Save() and instance SaveTo() methods
Snapshot.Save and instance SaveTo() methods.
SnapshotVerifyReportstruct
Returned by s.Verify()
Result ofVerify.
SnapshotUpperVerifyStatusstruct
Field of SnapshotVerifyReport
Upper-layer integrity details inside aSnapshotVerifyReport.