group:member, or artifact path.
Guest writeback
SetSnapshotCreateOptions.GuestFlush to msb.GuestFlushRequired, pass msb.WithBranchGuestFlush(msb.GuestFlushRequired) to Branch/BranchMany, or call source.PauseWithGuestFlush(ctx, msb.GuestFlushRequired). The default GuestFlushAuto flushes live disk-only captures, but adds no optional flush to full captures, branches, 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()
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 and 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.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.
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.