# vfs/mount Register (or replace) a VFS mount. After mounting, `fs/*` calls whose leading path segment(s) name the mount route to its driver instead of the native filesystem. Publishes a change event on the `"vfs"` pub/sub topic. ## Syntax
[vfs/mount "name" spec]
## Parameters - `"name"` — the mount name: the leading path segment(s) that route to it (e.g. `"prod"`, `"deft/ui"`). Non-empty; no `:`; no leading, trailing, or doubled `/`. - `spec` — a map (or tagged map) describing the backend: - `%{ :kind :local :root "<dir>" }` — native filesystem anchored at `:root` (shorthand: `%Local{ :root "<dir>" }`) - `%{ :kind :ssh :host "<host>" :root "<remote-dir>" :user "<u>"` :port 22 :identity "<key>" :jump "<bastion>" :options @{"<opt=val>"} }` — remote host over ssh (shorthand:` `%Ssh{ ... }`). `:user` may instead be embedded in `:host` as `"user@host"`. Auth comes from the system ssh client (keys/agent, ssh_config, known_hosts). Defaults `-o BatchMode=yes -o` ConnectTimeout=10` are applied before `:options`, so a later` option can override either. ## Examples
# Local directory under a short name
[vfs/mount "docs" %Local{ :root "/usr/share/doc" }]
[fs/read "docs/misc.txt"]

# Remote host over ssh
[vfs/mount "prod" %{ :kind :ssh :host "10.0.0.5" :root "/srv/app"
                     :user "root" }]
[fs/write "prod/config.toml" "..."]
[os/cwd]  # unaffected — mounts are path-prefix routing, not chdir
Mounts are also declarable in the prelude `:mounts` map — a map (or `%Local{}`/`%Ssh{}`) value there seeds the same mount table at startup; string values stay classic import mounts. See VFS. ## Returns `true` on success; `%Err` on an invalid name or spec. Subscribers on the `"vfs"` pub/sub topic receive `%{ :name "prod" :value <spec> :old <old-spec-or-nil> }` under `:data`. ## Notes - A mount is a chroot: `prod/../../etc` clamps at the mount root. - Runtime mounts write through to the shared config registry under `vfs.mount.<name>` (stringified) for visibility tooling. - Not supported on mounts (v1): `fs/watch`, `fs/link`, `fs/glob` with `:recurse`, cross-mount `fs/rename`. ## See Also `vfs/unmount`, `vfs/list`, the VFS manual chapter