hf Spaces volumes mount models, datasets, and buckets
Introduced 2026-04-02 · score 0.92
HOW TO USE IT
When a Space needs filesystem access to Hub models, datasets, or buckets, pass one or more `-v`/`--volume` values to `hf repos create` or `hf repos duplicate`. Use `hf://[TYPE/]SOURCE:/MOUNT_PATH[:ro]`; models, datasets, and Spaces mount read-only, while buckets are read-write by default.
hf repos create <space-id> --type space --space-sdk <sdk> -v hf://<model-id>:/models -v hf://buckets/<owner>/<bucket>:/datahf repos duplicate <source-space-id> <destination-space-id> --type space -v hf://<model-id>:/models -v hf://buckets/<owner>/<bucket>:/dataWHY THIS HELPS
Configure a Space to access model, dataset, or bucket files through mounted filesystem paths.
BEFORE THIS CHANGE
Use the deprecated persistent storage feature for Space storage.
REQUIREMENTS AND LIMITATIONS
- Version: v1.9.0
- REPO_ID (required): Destination repo ID for `hf repos create`.
- --type space (required): Sets the repository type to Space; `--type` also accepts model or dataset.
- --space-sdk <sdk> (required): Sets the Space SDK; required when creating a Space.
- FROM_ID (required): Source repository ID for `hf repos duplicate`.
- [TO_ID]: Destination repo ID for `hf repos duplicate`; defaults to your namespace with the same repo name.
- -v, --volume TEXT: Repeat to mount volumes. Format: `hf://[TYPE/]SOURCE:/MOUNT_PATH[:ro]`. TYPE allows models, datasets, spaces, or buckets; it defaults to models when omitted. Models, datasets, and Spaces are always read-only; buckets are read-write by default. The `:ro` suffix selects read-only mounting. The docs do not describe volume values as mutually exclusive.
- Prerequisite: The CLI repository guide says the machine must be logged in and the user must own the repository or have write permission in its organization.
- Prerequisite: When creating a Space, provide its required SDK with `--space-sdk`.
- Volumes provide direct filesystem access to models, datasets, and storage buckets.
- Persistent storage is deprecated.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.9.0
- https://huggingface.co/docs/huggingface_hub/v1.9.0/en/package_reference/cli
- https://huggingface.co/docs/huggingface_hub/v1.9.0/guides/repository
Check the installed version and the source before using it. Entry JSON