/gdrive/.
For Google OAuth setup, see Google Workspace Setup.
Config
folder_id.
The mount root becomes that folder. The folder may live in My Drive,
be shared with you, sit inside a Shared Drive, or be a Shared Drive
id itself; the drive scope is resolved automatically. Scoped mounts
do not surface other shared drives:
Filesystem Layout
root folder plus each Shared Drive visible to
the user. Shared Drives appear as top-level directories. Duplicate names
receive a [Shared Drive] suffix and, when needed, a numeric suffix.
Subfolders appear as directories, and regular files keep their original names.
Synthetic Extensions
Google Workspace files cannot be downloaded as raw bytes, so they are exposed with synthetic extensions and read via their respective APIs:
Regular files (PDFs, images, CSVs, etc.) are downloaded directly
from Drive. Large regular files use streaming.
Write Support
UnderMountMode.WRITE the standard write commands work on regular
files and folders: tee, cp, mv, rm, mkdir, rmdir,
touch, truncate, and in-place editors such as sed -i. Semantics
follow the other object-store mounts (GNU check-then-act: EEXIST
on mkdir over an existing name, mv onto a non-empty directory
fails with ENOTEMPTY, cp -r merges).
Google-native files (.gdoc.json, .gsheet.json, .gslide.json)
are read-only as bytes; writing to them fails with EACCES. Mutate
them through the gws commands below instead.
Drive access is per-item (shared-drive roles, folder-level grants), so
a write mount can still hold items you may not edit. A mutation the
API denies fails with EACCES (Permission denied) on that operand,
like a real filesystem; the rest of the mount keeps working.
Writing inside a Shared Drive
A Shared Drive is not a read-only corner of the mount. Every Drive call mirage makes carriessupportsAllDrives, so create, write, rename, copy
and delete work the same inside a Shared Drive as in My Drive, and the
commands above behave identically there.
What you may actually do is decided by Drive, not by mirage: a Shared
Drive has its own role model (viewer, commenter, contributor,
content manager, manager), and some organizations restrict deletion
or moving content out of the drive. mirage does not attempt to predict
those rules. It issues the operation and reports the answer, so a role
that forbids the change fails with EACCES on that operand, exactly like
an unwritable item in My Drive.
The practical consequence is that a write mount spanning Shared Drives is
partly writable, and the boundary follows your roles rather than the
mount. If you want a mount that cannot write at all, use
MountMode.READ; if you want to scope one to a single drive, set
folder_id to the Shared Drive id.
Snapshots
The resource supports workspace snapshots. Recorded reads capture the file’s Drive revision (headRevisionId), and a loaded snapshot pins
reads to that revision via the Drive Revisions API, so replay serves
the exact bytes the agent saw.
Cache
The Google Drive resource usesIndexCacheStore (same as Slack,
Gmail, and other resources). Index entries store folder IDs, file
IDs, and file metadata. There is no separate content cache — file
content caching is handled by the workspace IOResult mechanism.
Example
examples/google/gdrive.py for the full working example.
Shell Commands
Standard commands available on the mounted Google Drive tree:Data Format Support
Google Drive may contain data files in binary columnar formats. These are auto-converted to CSV on read. Specialized variants of common commands handle them natively:
Example: