Sandbox filesystem architecture
The sandbox filesystem abstraction gives each sandbox a controlled guest root and a set of explicit mounts. It keeps root images, writable state, shared storage, temporary storage, and host paths separate while presenting the same storage model through local and cloud backends.
Storage model
The filesystem model has three layers of concern: the guest root, extra mounts, and the interface used to reach storage. A sandbox can use an image or host tree as its root, then add only the storage paths that the workload needs.
Guest roots
The guest root is the filesystem mounted at / when the sandbox starts. The root source determines whether the sandbox uses an OCI image, a host directory, or a disk image, and it also determines which parts of the state are private and which parts are owned outside the sandbox.
| Root source | Guest view | State ownership |
|---|---|---|
| OCI image | Read-only image content plus a writable root layer | Image content is shared or cached; the writable state belongs to the sandbox |
| Host directory | The host directory itself as the guest root | The host directory remains the source of truth |
| Disk image | A block-backed filesystem from the supplied image | The image file remains under caller control |
An OCI root normally uses immutable image layers with a separate writable layer. A flat OCI root is the alternative shape: it materializes the complete image into one private filesystem, then makes a private copy for the sandbox. This keeps image content reusable without allowing writes from one sandbox to change another. References: packages/…/domain.rs• L64-167, sdk/…/create.rs• L117-149, sdk/…/spawn.rs• L2548-2633
Writable root state
The writable part of an OCI root is a policy choice rather than a single storage type. The choice controls whether writes survive a restart, where capacity comes from, and who may resize or delete the data.
| Root storage | Main purpose | Lifetime and capacity |
|---|---|---|
| Managed disk | General persistent sandbox state | Sandbox-owned and grow-only; removed with the sandbox |
| Memory-backed temporary filesystem | Fast, disposable state | Reset on boot; consumes guest memory |
| Supplied disk image | Caller-managed persistent state | The caller owns its file and its lifecycle |
| Flat private filesystem | A complete private OCI root | Sandbox-owned private copy with its own capacity |
The default managed form gives a sandbox durable writable state without changing the cached image. A temporary root is useful when the workload must start from a clean image on every boot. A supplied image gives the caller direct control of the writable disk. References: packages/…/domain.rs• L111-167, sdk/…/types.rs• L728-882, sdk/…/upper.rs• L1-63
Mount model
Mounts add storage below the guest root at explicit guest paths. Each mount has one backing kind and a matching set of policies, so the guest sees a deliberate composition instead of an accidental view of the host.
Mount kinds
The mount kind describes how data reaches the guest. Directory-backed mounts use a filesystem passthrough path, while disk-backed mounts present a block device that the guest mounts as a filesystem.
| Mount kind | Backing | Typical use |
|---|---|---|
| Bind mount | A selected host directory or file | Share selected host data with one sandbox |
| Named directory volume | Managed persistent directory | Reuse live data across sandbox runs or sandboxes |
| Named disk volume | Managed disk image | Persistent block storage with an explicit filesystem |
| Temporary filesystem | Guest memory | Scratch data that must not persist |
| Disk image mount | A caller-supplied disk image | Attach an existing filesystem at a guest path |
Named volumes are separate resources. They can outlive a sandbox and can be mounted by more than one sandbox. A directory volume shares live file changes, while a writable disk volume needs single-writer discipline to avoid filesystem corruption. References: packages/…/domain.rs• L350-433, sdk/…/types.rs• L204-558, docs/…/filesystem.mdx• L38-55
Mount policies
Mount policies define how much authority crosses the host-to-guest boundary. The common safe shape is a read-only mount with private guest metadata and no direct execution when the workload only needs to read host data.
- Access flags control write access, direct execution, set-user-ID behavior, and device-file access.
- Write quotas limit how much new data a guest may add to a bind mount. Named volumes carry their own storage limits.
- Metadata view controls whether guest ownership and mode changes stay in a guest-side view or reach host inodes.
- Host permission propagation is separate from the metadata view on Unix passthrough mounts. Private mode keeps host file and directory modes conservative. Mirror mode copies only ordinary permission bits to regular files and directories while keeping owner access and host privilege bits safe.
- Host path resolution controls whether the selected root may follow host symlinks. The default keeps the mount rooted at the selected path.
These policies apply to the backing kind that can support them. Directory-backed mounts can virtualize guest ownership and mode without changing the host view, while file size and timestamps remain tied to the host data. Size-changing operations also consume the mount quota and report the quota as the guest filesystem capacity. Guest extended attributes expose only permitted user attributes; internal service and host security namespaces remain outside the guest contract. Strict metadata mode requires xattr support at mount time. Read-only mounts need read support, while writable mounts need write support. Relaxed mode can work without that capability, and Off mode uses host metadata directly. The configuration boundary rejects combinations that would silently lose a requested policy. References: packages/…/domain.rs• L189-217, sdk/…/types.rs• L304-491, sdk/…/spawn.rs• L2636-2773, crates/…/mod.rs• L63-189, crates/…/metadata.rs• L143-218, crates/…/xattr_ops.rs• L182-269
Backend boundary
The backend boundary keeps filesystem intent stable while the storage authority changes. A local backend prepares host paths and devices for a local microVM, while a cloud backend sends the same resource intent to the cloud service and reaches remote sandbox agents or managed volumes through remote routes.
Filesystem crate boundary
The microsandbox-filesystem crate is the shared filesystem support boundary for guest filesystem access and host-side filesystem backends. It packages guest agent support through build features and exposes platform-appropriate backend contracts, so higher-level sandbox code can use a common filesystem vocabulary while the host platform supplies the needed storage behavior.
The crate also exposes bounded runtime-script staging on Unix. This supports cold-boot script inputs and controlled replacement backing without treating a small script set as a complete filesystem checkpoint.
The guest agent payload is selected once for the host process. A build can embed and validate an architecture-matched payload, or a runtime path can supply a validated replacement. The build records capabilities of the actual embedded payload, so a runtime override cannot grant embedded storage-reader or private disk-editor capability. Recovery uses the host binary's embedded reader rather than an arbitrary override, so filesystem recovery does not depend on a guest agent with unknown storage capabilities. References: crates/…/Cargo.toml• L1-37, crates/…/lib.rs• L1-61, crates/…/agentd.rs• L16-157, crates/…/runtime_scripts.rs• L22-66
The crate exports the guest agent and common filesystem types on supported host targets. Unix builds expose the local composition backends used for memory, passthrough, and layered reads. Windows builds expose passthrough and single-file support. The public surface also includes an unavailable transport for explicit relaxed restore when an external backing is not present. References: crates/…/mod.rs• L1-15, crates/…/lib.rs• L18-61, crates/…/unavailable.rs• L11-63
Backend routing
Sandbox and volume handles retain the backend that created or fetched them. This prevents a later change to the process default from redirecting an existing handle to a different storage system.
Guest filesystem operations address paths inside a running sandbox through the sandbox agent. Volume filesystem operations address a named volume directly through the volume backend, so they can work without a running sandbox. The public operation shape stays uniform across local and cloud backends even though local storage is host-backed and cloud storage is service-backed.
This split lets a caller choose between operating on the guest view and operating on persistent volume data. It also keeps backend-specific transport and storage rules out of the higher-level filesystem contract. References: sdk/…/mod.rs• L145-203, sdk/…/sandbox.rs• L309-341, sdk/…/volume.rs• L153-288, sdk/…/fs.rs• L30-45, sdk/…/fs.rs• L1-46
Host platform boundary
The local backend translates the same root and mount model into the host runtime used by Linux, macOS, and Windows. The platform changes the host transport and path handling, not the guest-facing distinction between directory mounts, block devices, memory filesystems, and private root state.
The filesystem crate makes this boundary explicit through target-specific backend exports. Unix builds provide the local filesystem variants used by the Unix runtime, while Windows builds provide the Windows passthrough and single-file variants. The local start path still prepares sandbox-owned storage and mount inputs before it starts the VM. It also uses platform-specific endpoint handling for the guest agent, which lets filesystem calls use one SDK surface after the VM is ready. References: crates/…/lib.rs• L18-61, crates/…/Cargo.toml• L28-37, sdk/…/mod.rs• L52-83, sdk/…/spawn.rs• L263-279, sdk/…/spawn.rs• L373-387, sdk/…/spawn.rs• L1079-1085
Unix passthrough mounts can resolve a root with no symlink or parent traversal in any path component. They keep guest metadata separate from host metadata when the selected policy needs that view. Strict mode checks the xattr capability needed by the mount's access mode. Private host permissions keep backing inodes accessible to the host process, while Mirror mode shares ordinary file and directory permission bits without copying ownership or privilege bits. Guest-created special files can remain regular host files with their guest type stored in the metadata view. References: crates/…/mod.rs• L1042-1184, crates/…/host_mode.rs• L35-112, crates/…/create_ops.rs• L41-48, crates/…/metadata.rs• L143-218
Unix guest extended attributes use a narrow boundary. Ordinary user attributes can cross it, but service metadata, overlay metadata, and host security namespaces cannot be created, read, listed, or removed through guest requests. This rule stays the same across Strict, Relaxed, and Off stat virtualization. References: crates/…/xattr_ops.rs• L1-14, crates/…/xattr_ops.rs• L182-269, crates/…/test_xattr_ops.rs• L34-98
Windows directory views also guard the selected root against host reparse points such as junctions. Directory listings omit rejected entries instead of exposing paths outside the mount, while direct lookup and access keep returning a loop error. Ordinary siblings remain visible and directory continuation offsets stay usable. References: crates/…/dir_ops.rs• L88-117, crates/…/tests.rs• L290-353
Passthrough mounts can also use DAX, or direct guest mapping of file ranges into a shared memory window. On Unix, the backend maps host file ranges into that window. On Windows, it keeps host memory-mapped views alive while a VMM worker installs the guest mapping. Both paths enforce read-only mount and init-file rules before they bypass ordinary file reads and writes. References: crates/…/dax.rs• L1-80, crates/…/dax.rs• L1-156, crates/…/memory_mapping.rs• L25-52
The shared backend contract reserves /init.krun as a synthetic read-only file that carries the guest agent. The file has no ordinary host path, cannot be changed or removed, and can be served through the same passthrough interface as other guest files. Its payload is immutable after process selection, and builds that need the private storage reader mark that capability from the actual embedded artifact. References: crates/…/init_binary.rs• L1-11, crates/…/init_binary.rs• L21-28, crates/…/init_binary.rs• L126-148, crates/…/agentd.rs• L16-20, crates/…/build.rs• L27-32
Single-file mounts use the passthrough rules for data access but expose a synthetic directory with one selected file. They keep the host parent and sibling names outside the guest view, while host-side replacement can make new opens follow the selected path without invalidating existing handles. References: crates/…/mod.rs• L54-63, crates/…/mod.rs• L75-163, crates/…/mod.rs• L289-331
Unix passthrough mounts preserve file identity and open-handle lifetime when names change. An unlinked file remains usable through an existing handle, and a later guest open can still find the tracked file while enforcing the requested access. The handle table supports lookup by both handle and inode, so metadata and extended-attribute requests can use a still-open object instead of reopening a changed path. Create also registers the inode from the descriptor it opened, which prevents a host rename-and-replace race from returning a different file. References: crates/…/handle_table.rs• L11-69, crates/…/inode.rs• L215-329, crates/…/inode.rs• L541-675, crates/…/create_ops.rs• L128-166, crates/…/xattr_ops.rs• L346-373
Common guest operations for synchronization, space allocation, sparse-file seeking, copying, and capacity reporting use host-backed semantics with platform-specific support or fallback. Linux can copy ranges in the host kernel, while macOS reports that operation as unavailable so the guest can use read and write; macOS space allocation reserves only the part past end of file and does not grow a file for a range that ends inside it. Quotas charge growth before allocation or copy and report the quota as guest filesystem capacity. References: crates/…/special.rs• L88-190, crates/…/special.rs• L193-329, crates/…/test_quota.rs• L17-111
Windows passthrough mounts also keep one logical guest inode for a host file when the file has more than one path or when its tracked namespace link is removed. The backend retains the host object while guest lookups or open handles still need it, then reclaims that retained state after those references end. This gives Windows mounts stable guest identity without making the host path the only identity for a file. References: crates/…/inode.rs• L9-26, crates/…/inode.rs• L81-153, crates/…/inode.rs• L190-225
Windows DAX mappings remain tied to the same host file identity as ordinary passthrough access. The backend withdraws those views before host operations that cannot run while a file is mapped, then restores the guest mappings for the file ranges that still exist. This keeps file growth and host-side changes consistent with the guest view. References: crates/…/dax.rs• L198-261, crates/…/dax.rs• L286-320, crates/…/memory_mapping.rs• L123-185
Runtime script staging
Runtime script staging prepares a small private runtime share for boot or controlled restore. It handles registered files as exact bytes plus guest-visible ownership and mode, while the host keeps private access permissions. The staged directory is temporary and is not installed or executed by this filesystem layer.
The process has separate paths for new boot input, exact observation of a pinned source, and source-independent recreation after the source is gone. Each path bounds names and bytes, rejects links and unsupported file forms, checks for changes, and removes incomplete staging. Registered scripts are not a complete filesystem state: unregistered files and open handles still require full filesystem capture and admission.
This diagram shows how runtime script data moves from a source or boot input into private backing without granting staging authority over the final guest or checkpoint.
flowchart LR
Input[Boot input or pinned source] --> Check[Validate names, bounds, bytes, and guest metadata]
Check --> Stage[Create private temporary runtime share]
Stage --> Verify[Recheck backing and metadata]
Verify --> Output[Caller-owned staging output]
Verify -->|failure| Discard[Discard incomplete output]
The guest metadata overlay for this runtime share keeps virtual ownership and mode separate from host access permissions. It accepts only regular files and directories with matching guest and host types, so virtual metadata cannot turn private backing into a special file or executable host object. References: crates/…/runtime_scripts.rs• L22-66, crates/…/runtime_scripts.rs• L108-269, crates/…/runtime_scripts.rs• L308-501, crates/…/file_metadata.rs• L15-57
Filesystem lifecycle
Filesystem state is assembled during sandbox creation and attached during start. The lifecycle keeps validation, resource provisioning, and guest exposure in that order so a bad mount or missing backing file fails before the sandbox presents an incomplete filesystem.
Creation sequence
When a sandbox is created, the system resolves the root source, prepares any sandbox-owned writable state, provisions requested named volumes, and then passes the complete storage plan to the runtime.
sequenceDiagram
participant Caller
participant Builder as Sandbox configuration
participant Backend
participant Storage as Root and volume storage
participant VM as Guest runtime
Caller->>Builder: Select root and mounts
Builder->>Backend: Submit validated storage intent
Backend->>Storage: Resolve images, disks, directories, and volumes
Storage-->>Backend: Ready backing resources
Backend->>VM: Attach root and mount plan
VM-->>Caller: Guest filesystem is available
For an OCI root, image resolution happens before root assembly. For a host root, patches can change the selected host tree before boot, so that root is not an isolated copy. Named-volume creation occurs before the sandbox record is finalized, which avoids leaving a sandbox that refers to storage that could not be created or matched. References: sdk/…/create.rs• L94-115, sdk/…/create.rs• L117-150, sdk/…/create.rs• L254-359
Checkpoint restore bindings
Checkpoint restore treats external storage as a destination binding problem. A restore maps each captured directory or disk resource to an explicit compatible destination, or to an authorized source-local mapping when inheritance is enabled; it does not create a new empty named resource to satisfy a missing dependency.
The restore boundary preserves the captured guest topology and mount flags. It rejects duplicate paths and identities, requires existing named directory volumes for external directory mappings, and removes creation intent from an admitted named volume so a later race cannot turn restore into resource creation. Strict restore reports an unavailable explicit mapping as an error. Relaxed restore can expose an unavailable external mount as an error-serving filesystem, while complete restore still fails when required backing is absent.
Before any external binding is accepted, the checkpoint must show a clean guest writeback boundary. This keeps restore tied to filesystem state that was synced at capture time rather than to a caller's restore preference. References: sdk/…/external_mounts.rs• L23-123, sdk/…/external_mounts.rs• L125-305, sdk/…/external_mounts.rs• L309-380
State boundaries
The key lifecycle question is who owns a byte and how long it should remain available. Use the following boundaries when reasoning about restart, deletion, sharing, and snapshot behavior.
- A cached image is a reusable base and is not changed by guest writes.
- A managed writable root belongs to one sandbox and follows that sandbox's lifecycle.
- A temporary filesystem belongs to one boot and is discarded on the next boot.
- A bind mount changes or exposes host data according to its mount policy.
- An open file can remain usable after its directory name is removed; a later guest open must still resolve the same tracked file identity.
- A named volume survives sandbox deletion until the volume itself is removed.
- A disk-backed resource should not have more than one writable attachment at a time.
Snapshots capture disk state rather than live memory or process state. Restoring one therefore creates new runtime state from stored filesystem data; it does not resume the old VM. References: packages/…/domain.rs• L120-166, sdk/…/create.rs• L271-314, docs/…/filesystem.mdx• L18-25, docs/…/filesystem.mdx• L48-67
Filesystem state mobility
Filesystem backends can capture and restore bounded state when a sandbox or mount moves across a runtime boundary. The state carries the backend kind and schema so a receiver can reject data for the wrong backend or an unsupported format before it changes live filesystem state.
The mobility boundary uses a tagged frame with a schema and a caller-selected byte budget. Encoding stops at that budget, decoding rejects payloads outside it, and trailing bytes are rejected. Backend-specific restore then checks that saved paths, aliases, objects, handles, quotas, and policy state still match the destination before installing the state. Unix passthrough restore rebuilds its handle indexes from the saved handles, so restored file and inode lookups keep the same relationship as the source. References: crates/…/mobility.rs• L12-129, crates/…/mobility.rs• L147-329, crates/…/handle_table.rs• L60-69
Owned checkpoints carry private directory data as well as the logical filesystem state. Each generation stores a validated namespace and separately sealed file payloads, so hard-link identity, symlink targets, sparse data, guest metadata, and detached open files can survive restore without sharing writable inodes between materialized roots. The descriptor and payloads are integrity checked, and Unix and Windows generations are not interchangeable. References: crates/…/owned.rs• L1-7, crates/…/owned.rs• L176-228, crates/…/owned.rs• L266-312, crates/…/owned_unix.rs• L33-40, crates/…/owned_unix.rs• L179-210, crates/…/owned_mobility.rs• L56-184
External checkpoints instead keep host data in place and record enough identity to reject a changed or replaced destination, with relaxed restore marking invalid objects rather than treating them as valid old files. References: crates/…/mobility.rs• L215-305, crates/…/mobility.rs• L251-383
Single-file checkpoint state preserves the selected guest name and its admitted file handles while translating only the selected host basename. It rejects saved sibling paths and invalid admission records, so restore cannot widen a one-file mount into its host parent directory. References: crates/…/mobility.rs• L35-151, crates/…/mod.rs• L161-163
Unavailable external mounts
An unavailable external mount is an error-serving filesystem used only when relaxed restore allows the original host backing to be absent or changed. Restore first validates the captured binding and its destination mapping without opening the missing destination, then retains the binding for the restore boundary and returns I/O errors for later requests. References: crates/…/unavailable.rs• L11-63, sdk/…/external_mounts.rs• L183-272, crates/…/mobility.rs• L332-337, crates/…/mobility.rs• L411-417, crates/…/mobility.rs• L84-90
The unavailable transport is not a new writeback source. It cannot capture a new checkpoint because the external backing is not available to establish a valid writeback boundary. This preserves the distinction between restoring a known degraded state and creating a new snapshot from missing host data. References: crates/…/unavailable.rs• L43-53, crates/…/mobility.rs• L215-220, crates/…/mobility.rs• L251-259
Related backend behavior
Backend-specific operation and policy rules belong in Filesystem backends. Read that page when a change depends on local host paths, cloud volume routes, platform limits, checkpoint behavior, or the exact policy supported by a storage kind. Read Images and snapshots for the relationship between filesystem state, image state, and snapshot restore. Read Checkpoint and restore for runtime coordination around filesystem state capture and reattachment.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the root source model aligned with the runtime launch shape. A new root kind must have matching preparation and guest attachment behavior.
- Keep mount validation aligned with the wire representation. Guest paths, host paths, filesystem types, and mount options must remain unambiguous across Unix and Windows paths.
- Keep volume creation semantics aligned with persisted sandbox configuration. Sandbox-time create intent must not become a repeated create request on restart or checkpoint restore.
- Keep external restore admission aligned with resource identity and authorization. A missing named dependency must not become a newly created empty volume, and inherited source mappings must require the recorded source binding.
- Keep local and cloud backend routing aligned for both sandbox filesystem calls and direct volume filesystem calls.
- Keep storage ownership rules aligned with lifecycle actions. Resize, snapshot, restore, removal, and concurrent disk attachment must use the same owner model.
- Keep target-specific filesystem exports aligned with the host runtime. A backend available on one platform must not be assumed to exist on another platform.
- Keep inode identity and detached-handle behavior aligned with unlink, rename, alias lookup, and host-side removal. Existing handles must keep their access, while new opens must recheck the requested access.
- Keep guest metadata, host metadata, and quota reporting aligned. A virtual guest mode or ownership change must not change the data or capacity semantics by accident.
- Keep host permission propagation aligned with stat virtualization. Mirror must stay limited to regular files and directories, preserve host owner access, and never copy guest ownership or privilege bits.
- Keep guest xattr filtering aligned with the protected host namespaces. The filtered list and its size query must describe the same guest-visible names.
- Keep special file operations aligned with guest semantics on each host. Linux range copies, macOS fallocate behavior, sparse-file seeking, quota charging, and filesystem capacity reporting must preserve the same guest contract or its documented fallback.
- Keep DAX mapping permissions aligned with ordinary passthrough access. Direct mappings must enforce read-only mounts and the immutable init file before they bypass normal file operations.
- Keep Windows DAX view lifetime aligned with host file operations. Resize and other operations that cannot run with mapped views must withdraw and restore the affected guest ranges.
- Keep Windows reparse-point filtering aligned between directory listings and direct path access. A rejected junction must not hide ordinary siblings or become reachable through enumeration.
- Keep the packaged agent support feature aligned with the release path that embeds or fetches the guest filesystem agent. Runtime overrides must remain architecture-valid, and recovery must continue to use the embedded reader capability.
- Keep runtime-script staging separate from full filesystem capture. Registered script backing must not authorize unregistered files, open handles, or activation of a destination.
- Keep runtime-script limits, names, bytes, and guest metadata checked before private staging is adopted. A late source or destination change must discard the incomplete staging output.
- Keep mobility state tags, schema versions, and configured size limits aligned across every backend that captures or restores state.
- Keep owned checkpoint payloads aligned with detached files, aliases, guest metadata, platform family, and the private directory generation that stores their data.
- Keep single-file checkpoint translation limited to the selected basename and its admitted handles.
- Keep relaxed external restore aligned with the unavailable transport. A degraded mount must validate its saved state and must not become a new checkpoint source.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A mount uses a duplicate or invalid guest path | The runtime cannot form a deterministic guest tree | Validate absolute non-root paths and reject duplicates before spawn |
| A writable bind mount has no effective write limit | Guest data can consume host storage through the shared directory | Apply the protective bind quota or set an explicit quota |
| Two sandboxes attach the same disk image for writing | Filesystem state can become corrupt | Enforce single-writer use or mount shared disks read-only |
| A flat root is smaller than the materialized image | The private root cannot be created | Require capacity at least as large as the cached image |
| A requested mount policy does not apply to its backing kind | The request could be silently ignored or mislead the caller | Reject unsupported policy combinations during configuration |
| Strict passthrough lacks the xattr capability required by its access mode | Mount setup fails instead of exposing an incomplete metadata contract | Probe read support for read-only mounts and write support for writable mounts |
| Mirror mode copies guest ownership, special-file type, or privilege bits to a host inode | Host access or privilege state can change outside the guest contract | Mirror only ordinary permission bits on regular files and directories, with an owner floor |
| A guest request reaches an internal or host security xattr namespace | Service metadata or host security state can be exposed or changed | Allow only non-empty ordinary user.* names and filter before size reporting |
| A named volume is recreated with incompatible kind or labels | The sandbox may use the wrong persistent data or fail to start | Match existing volume metadata before attaching it |
| A host-backed file loses its tracked identity during unlink or rename | Existing handles or later guest opens can fail or address the wrong file | Preserve identity across namespace changes and validate it before reopening |
| Windows passthrough treats an alias as a new guest inode | Guest caches can hold conflicting contents or attributes for one host file | Reuse the tracked logical inode for the host file identity |
| A Windows directory listing follows a host reparse point | The guest can see data outside the selected mount root | Omit rejected reparse points from listings and return a loop error for direct access |
| A DAX request asks for write access on a read-only mount or the init file | Direct guest mapping can bypass normal file access checks | Reject writable DAX mappings from the mount mode and immutable init-file rules |
| A Windows host operation runs while its file views remain mapped | Resize or other host changes can fail, or guest mappings can become stale | Withdraw affected views under the file lock and refresh surviving ranges |
| A macOS caller requests an unsupported fallocate mode | The guest operation fails instead of changing storage with a different mode | Reject non-default modes with the documented unsupported error |
| A file allocation or range copy grows past the mount quota | The operation can exceed the guest's advertised storage budget | Charge the target range before allocation or copy and report quota capacity |
| A runtime script name escapes one filename or a script exceeds the trusted bounds | Staging can expose the wrong path or consume unbounded host storage | Validate names and limits before creating any staging files |
| Runtime script backing changes after observation or during staging | The destination may contain stale or mixed script data | Pin the source, revalidate bytes and guest metadata, and discard failed staging |
| Registered runtime scripts are used as a complete filesystem checkpoint | Unregistered files or handles cannot be restored consistently | Require full filesystem state for full resume and keep script staging source-independent |
| An owned generation has invalid namespace data, changed payload bytes, or the wrong platform family | Restore can expose altered files or fail after partial materialization | Validate the descriptor, payload digest, namespace, metadata, and platform before install |
| A restore uses a missing named volume with create-if-absent intent | Restore can create a new empty resource instead of reconnecting captured data | Admit only existing compatible directory volumes and remove creation intent |
| Captured external mount flags or identities do not match the destination | Restore can expose a different guest topology or security policy | Require matching paths, device identities, and access flags before launch |
| A caller assumes a target-specific backend is available on every host | The filesystem support cannot build or the selected runtime lacks its backend | Use the platform-specific public surface and dependency set for the target |
| A build embeds a stale, invalid, or wrong-architecture guest agent | The filesystem cannot inject a compatible guest agent or storage reader | Validate the payload at build and runtime selection, and reject stale local artifacts |
| Restored backend state has the wrong kind, schema, size, or trailing data | The receiver may reject the state before restore or accept an unsafe payload | Require the mobility frame and bounded decode to pass before backend validation |
| A single-file state contains a sibling path or an unadmitted handle | Restore can expose the host parent or reconnect the wrong guest object | Validate the selected basename, guest name, and admission tables before install |
| Relaxed restore finds a missing external object and later captures it again | The system could treat an error-serving mount as a valid source of new state | Use UnavailableFs for requests and reject capture until the external root is available |
Key files
| File | Why to read it |
|---|---|
| packages/…/domain.rs | Defines the backend-neutral root, writable-root, and mount contract |
| sdk/…/types.rs | Shows how user storage choices become validated root and mount intent |
| sdk/…/mod.rs | Defines the local/cloud backend boundary used by filesystem resources |
| sdk/…/spawn.rs | Shows how the storage plan becomes attached guest roots and mounts |
| sdk/…/create.rs | Shows the local creation order for images, writable state, and named volumes |
| sdk/…/external_mounts.rs | Shows how checkpoint resources are mapped to existing external disks and directory volumes |
| sdk/…/fs.rs | Explains the guest filesystem interface for a running sandbox |
| sdk/…/fs.rs | Explains direct filesystem access to persistent volumes |
| sdk/…/volume.rs | Shows the cloud-side volume filesystem boundary |
| crates/…/build.rs | Selects, validates, and stages an embedded guest agent artifact |
| crates/…/agentd.rs | Selects the process-wide guest agent payload and recovery reader capabilities |
| crates/…/Cargo.toml | Defines the shared filesystem crate's platform dependencies and packaged-agent features |
| crates/…/lib.rs | Defines the public filesystem agent, backend, runtime-script, guest filesystem, and unavailable-transport surface by host target |
| crates/…/mobility.rs | Defines the tagged and bounded format used to move backend state |
| crates/…/unavailable.rs | Defines the degraded transport for relaxed external-mount restore |
| crates/…/mod.rs | Defines the isolated one-file guest view over a host file |
| crates/…/mobility.rs | Defines single-file checkpoint admission and basename translation |
| crates/…/owned.rs | Defines private owned-directory generations, payload integrity, and safe materialization |
| crates/…/owned_unix.rs | Defines Unix metadata, xattr, identity, and sparse-copy rules for owned generations |
| crates/…/mod.rs | Defines Unix passthrough policies, root containment, strict capability checks, and the guest operation boundary |
| crates/…/file_metadata.rs | Keeps private runtime backing metadata separate from host access permissions |
| crates/…/runtime_scripts.rs | Defines bounded runtime-script observation and private boot or restore staging |
| crates/…/runtime_scripts_tests.rs | Verifies exact script bytes, guest metadata, source races, and cleanup of failed staging |
| crates/…/host_mode.rs | Defines the host permission floor and the boundary between guest modes and host modes |
| crates/…/builder.rs | Defines Unix passthrough root, policy, quota, and state-limit setup |
| crates/…/handle_table.rs | Defines the dual handle and inode view used for stable open-object access |
| crates/…/create_ops.rs | Shows how guest-created objects, special types, and symlinks map to host objects |
| crates/…/metadata.rs | Shows the guest metadata view, host data boundary, and privilege-bit handling |
| crates/…/xattr_ops.rs | Shows guest xattr filtering and protected host namespace rules |
| crates/…/test_host_permissions.rs | Verifies private and mirrored host permission behavior |
| crates/…/test_xattr_ops.rs | Verifies guest xattr visibility and internal namespace protection |
| crates/…/inode.rs | Shows how Unix host file identity survives lookup, rename, and unlink |
| crates/…/special.rs | Defines Unix synchronization, allocation, sparse seeking, range copy, and capacity behavior |
| crates/…/mobility.rs | Defines Unix state capture, external identity checks, and handle reconstruction |
| crates/…/owned_mobility.rs | Defines private directory capture for owned Unix checkpoints |
| crates/…/builder.rs | Defines Windows passthrough root and metadata policy setup |
| crates/…/dir_ops.rs | Defines Windows directory snapshots and reparse-point filtering |
| crates/…/mobility.rs | Defines Windows identity, alias, external restore, and handle reconstruction |
| crates/…/owned_mobility.rs | Defines private directory capture for owned Windows checkpoints |
| crates/…/tests.rs | Verifies Windows root isolation, identity, metadata, quota, and mobility behavior |
| crates/…/init_binary.rs | Defines the immutable guest agent file shared by filesystem backends |
| crates/…/dax.rs | Shows Unix direct mappings between host files and the guest memory window |
| crates/…/dax.rs | Shows Windows DAX lifetime, permission, and VMM mapping behavior |
| crates/…/memory_mapping.rs | Shows the host view used to back Windows guest mappings |
docs/filesystem-backends.md | Child page for backend-specific operations and policy behavior |
docs/images-and-snapshots.md | Related page for image state and snapshot restore |
docs/checkpoint-and-restore.md | Related page for runtime checkpoint capture and restore coordination |