Skip to main content
Skip to main content

Connect & mount shared storage

This page covers how to connect an existing shared storage to runtime services, how to disconnect it, and how the mount behaves inside your containers.

How the mount behaves

Once a shared storage is connected to a runtime service, Zerops mounts it at /mnt/<storage-hostname> in the runtime containers. For example, /mnt/teststorage for a teststorage shared storage:

Mounted shared storage in the file browser
  • The content is shared among all containers of the connected runtime service; if you connect multiple runtime services, they all see the same content
  • Multiple storages can be mounted to a single service (e.g. /mnt/files1, /mnt/files2)
  • The mount point is owned by the zerops user and group (no sudo required)
  • Mounting removes any existing content of the mount directory
  • The mount is only available in runtime containers, not during build and prepare runtime phases
  • The mount process logs its standard output and error to the runtime service logs (tagged zerops-mount-<service-hostname>); individual file operations are not logged
Note

The df command may show incorrect or misleading information for shared storage mounts. Refer to the Zerops GUI for accurate storage metrics.

Connect in Zerops GUI

When creating a new shared storage service, you can directly select which runtime services it should be connected to. See Create shared storage for the creation process.

For existing storage, go to the shared storage service detail page and select Shared storage connections. Toggle ON any runtime services you wish to connect to this storage.

Connecting shared storage to runtime services

To disconnect storage, toggle OFF the desired runtime service in the same place.

Note

Connecting and disconnecting a shared storage is applied live; the runtime containers are not restarted.

Mount and unmount using zsc

You can also mount and unmount a shared storage from within a runtime container using the zsc command:

# Mount a shared storage
zsc shared-storage mount <storage-hostname>

# Unmount a shared storage
zsc shared-storage unmount <storage-hostname>

# Wait until the storage mount is ready
zsc shared-storage wait <storage-hostname>

Run these commands from your runtime container via web terminal or SSH, or as part of your zerops.yaml commands. For more details, see the zsc reference.

Caution

The shared storage must be mounted (through the GUI connection toggle or via zsc shared-storage mount) before your application can access the /mnt/<storage-hostname> directory.

Before stopping or deleting a shared storage service, you must first disconnect (unmount) it from all runtime services.