# Local and Network File Shares

> Source: https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/cloud_storage/file_share
> For the complete documentation index, see [llms.txt](https://docs.synthesized.io/llms.txt).

Read and write CSV data on a folder mounted on the worker host, such as an NFS or SMB share, without going through S3.

## Overview

A folder on the worker’s filesystem can serve as an input or output data source, addressed with a `file://` URL. Integration is a two-step model: the platform team mounts the share on the machine that runs the worker, and workflows refer to files through that mount path.

From Governor 1.177, an administrator registers the mount once as a **filesystem storage location**. Users then create data sources under it by giving a relative path, with no credentials to enter. With the TDK CLI, or on earlier Governor versions, the `file://` URL is used directly.

## Prerequisites

- The share is mounted on every host that runs a worker eligible to run workflows that use it, at the same path on each.
- The mount is visible inside the worker container. On Docker Compose, bind-mount it into the `worker` service; on Kubernetes, add a volume to the worker pod. The path **inside the container** is the path Governor uses.
- The user the worker runs as can read the input folders and write the output folders. The Helm chart images run as UID 1001. The most common failure is files copied onto the share by a named user with no read permission for others, which appears as an access-denied error even though the mount itself is fine.
- The folder you point at contains one sub-folder per table, with the CSV files inside, and no loose files at the top level. See [Directory layout](https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/cloud_storage/csv#_directory_layout). Use separate folders for input and output; the output folder must be empty when a run starts.

## Mount the share into the worker

- Docker Compose
- Kubernetes (Helm)

Use the same path on the host and in the container, so that the path users see on the share is the path they enter in Governor:

```yaml
services:
  worker:
    volumes:
      - /mnt/share/team-a:/mnt/share/team-a
```

Add the share as an extra volume on the worker. This example mounts an NFS export; a `hostPath` or a persistent volume claim works the same way.

```yaml
worker:
  extraVolumes:
    - name: team-share
      nfs:
        server: nfs.example.internal
        path: /export/tdm/team-a
  extraVolumeMounts:
    - name: team-share
      mountPath: /mnt/share/team-a
```

## Register the share as a storage location

Available from Governor 1.177.

### Steps

1. Sign in as an administrator and open the storage locations page in the Administration area.
2. Add a new storage location and choose the filesystem type.
3. Enter a name and the root path as it appears inside the worker container, for example `/mnt/share/team-a`.
4. If your workers are split across network zones, set the zone whose workers can reach this mount.
5. Save the location.

A filesystem location has no endpoint, bucket or credentials; the operating system permissions on the mount control access.

### Connecting a workflow to a folder on the share

Users with access to the storage location create a data source from it by giving the path **relative to the root path**, for example `ingress/customers` for input and `egress/customers` for output. The path must use forward slashes, must not start with a slash, and cannot contain `..`. Governor resolves it to `[file:///mnt/share/team-a/ingress/customers](file:///mnt/share/team-a/ingress/customers)` when the workflow runs.

## Use a file URL directly

With the TDK CLI, or on Governor versions before 1.177, give the mount path as a `file://` URL on a worker eligible to run the workflow:

```console
TDK_WORKINGDIRECTORY_ENABLED=true TDK_WORKINGDIRECTORY_PATH=/my-working-directory \
    tdk -c config.yaml \
    --input-url file:///mnt/share/team-a/ingress/customers \
    --output-url file:///mnt/share/team-a/egress/customers
```

The URL needs three slashes. `[file://mnt/share/…​](file://mnt/share/%E2%80%A6%E2%80%8B);` treats `mnt` as a host name, so the run fails with what looks like a missing folder rather than a malformed URL.

## Confirm success

After a run, the output folder holds one sub-folder per table, each with a `data.csv` file, as described in [CSV Support](https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/cloud_storage/csv).

## Troubleshooting

Access denied on a file that exists

The worker’s user cannot read it. Check the file’s owner and mode on the share, and for SMB mounts check the `uid` and `gid` mount options match the worker’s user.

Folder not found, but it exists on the host

The path is not mounted into the worker container, or the container path differs from the host path. Use the path as seen from inside the container, and prefer mounting at the same path on both sides.

Path must be relative to the storage location’s base path

A data source path under a storage location cannot start with `/`. Remove the leading slash and give the path relative to the location’s root.
