Skip to main content
The Disk VFS mounts a local directory at some prefix such as /data/. All operations are backed by real files on disk. Path resolution validates against the root boundary to prevent directory traversal escapes.

Config

DiskVFS(root=..., folder_versions=True) takes the root path of the directory to mount. Both READ and WRITE modes are supported.

Filesystem Layout

The Disk VFS mirrors the structure of the root directory. For example, if root="/srv/files" contains:
Then mounting at /data/ exposes:
Paths like ../../etc/passwd are rejected - resolution is always confined to the root boundary.

Cache

The Disk VFS uses IndexCacheStore with index_ttl = 60 (1 minute). Directory listings are cached for up to 60 seconds before being refreshed from disk. Each listing is stored with its folder’s version: the folder’s device, inode, change time and modified time. Under read: fresh, a later command stats the folder and serves the cached listing while the version still matches, so it pays one local stat per listed folder instead of a scan. A folder changed in the last 2 seconds gets no version and is re-listed until it has been quiet that long, since two changes inside one timestamp tick could leave its times unmoved. This assumes a local POSIX filesystem, where adding, renaming or removing an entry moves the folder’s change time. A network or FUSE root (NFS, SMB, rclone, s3fs, mirage’s own FUSE) may not, so turn the versions off there:
That mount then re-lists a cached folder once per command, as every unversioned backend does. See the cache.

Example

Shell Commands

The Disk VFS supports the full set of shell commands since it operates on real file content (text, binary, JSON, CSV, etc.):

Read Commands

Text Processing

File Operations

Path Utilities

Compression

Encoding

Use Cases

  • Local directory access: Mount local directories for AI agents to read and process
  • Sandboxed file access: Restrict agent file operations to a specific directory tree
  • FUSE mounting: Expose disk files through a virtual FUSE mount for external tools
  • Data pipelines: Process local datasets with shell-like commands
  • Development: Test file operations against real data before deploying to cloud mounts