# Linux mount

Mount every space as an ordinary folder on a render node, server or CI machine with no desktop, through FUSE, with a token and a systemd service.

On Linux machines without a desktop (render nodes, servers, CI runners), one command mounts all your spaces as an ordinary folder that any program can read and write:

```sh
sidespace login you@example.com        # or use a token, see "Unattended" below
sidespace mount --at ~/SideSpace       # Ctrl-C or umount ~/SideSpace to stop
ls ~/SideSpace                          # one folder per space
```

## How it works

- It mounts through FUSE, with the same logic as the Mac's mount.
- Reading a large file fetches only the part you use: a player that jumps to minute 40 downloads only the chunks around it, not the whole file first.
- Writes stay on the machine first. Once a file has been quiet for 2 seconds it is saved as a new version; `fsync` saves at once.
- Programs that save through a temporary file and a rename keep the file's history: the result is a new version of the original.
- `mv` and `mkdir` reach the space. `rm` moves a file to the trash for 30 days. `rmdir` removes only empty folders.
- Changes others save show up within about a second: new files appear, and reopening a file reads the new content.
- When it stops (Ctrl-C, `SIGTERM`, `umount`) it saves pending writes first, then unmounts. A mount point left behind by a crash is cleared on the next start.
- Running as root needs nothing else. Other users need `fusermount3` from the `fuse3` package: `apt install fuse3`.
- Only the user who mounted can see the files. Add `--allow-other` to let other users on the machine in; without root, also enable `user_allow_other` in `/etc/fuse.conf`.

How fast it feels, measured, is on the [performance page](/docs/performance).

## Unattended: a token and a mount at boot

To avoid signing in to an account on the machine, give it a token of its own, limited to the spaces and permissions it needs:

```sh
# on your own computer
sidespace token create render-01 --scope files:read --scope files:write --space "Film A"
```

Put the token in `~/.config/sidespace/mount.env` on the machine:

```sh
SIDESPACE_TOKEN=ssp_…
```

The package includes a systemd user service that keeps the spaces mounted at `~/SideSpace`, restarts it after a crash and saves before it stops:

```sh
systemctl --user enable --now sidespace-mount
loginctl enable-linger $USER            # mount at boot, even with nobody logged in
journalctl --user -u sidespace-mount    # logs
```

The token sees only the spaces it was given. Revoke it with `sidespace token revoke` and the machine loses access at once.

## Packages

`scripts/package-linux.sh` builds a static `sidespace` in a `rust:alpine` container, so it doesn't depend on the glibc version and runs on any distribution. It makes two files:

- `sidespace-<version>-linux-<arch>.tar.gz`: the binary, the service file and these instructions.
- `sidespace_<version>_<arch>.deb`: installs `/usr/bin/sidespace` and the user service in `/usr/lib/systemd/user/`, and recommends `fuse3`.

They are not on a public download page yet; build them from the repository, or ask us for the current build.

## Or NFS

Where FUSE isn't available (a container without `/dev/fuse`, for example), `sidespace mount --nfs` serves the spaces over NFS and prints the matching `sudo mount -t nfs …` line. It needs `nfs-common`.
