# Data and volumes

Everything CrushMFT keeps is in one folder, `/app/CrushMFT27`, the container's working folder. Mount a volume there and your data survives new containers, new images and updates. The volume also holds the program CrushMFT runs, put there from the image; that part never needs a backup, since the image puts it back.

## What is in the volume

| Path | What |
|---|---|
| `prefs.XML` | the server's settings |
| `users/` | users, groups, inheritance, each user's settings and virtual folders |
| `jobs/` | jobs, their schedules and history |
| `logs/`, `CrushMFT.log` | the server log and the session logs |
| `ssh_host_*_key`, `.pub` | the SFTP server's host keys. Keep them, or clients warn that the server changed. |
| `CrushMFT.jar`, `CrushLauncher.jar`, `plugins/`, `WebInterface/`, `release.txt`, the starters (`CrushMFT.exe`, `CrushMFT.app`, `crushmft_init.sh`, not used in a container) | the running version of the program, put there from the image (or by the in-app updater), as on every CrushMFT 27 installation ([How it works](How-It-Works.md)) |
| `backup/updates/` | earlier and staged versions (`v27.0.0_289/`, ...), and the update state |
| `backup/` | also CrushMFT's own backups of `prefs.XML` and users, and the launcher's working copies of the jars (`backup/_tmp/`) |
| `activity/`, `statsDB/`, `syncsDB/` | the activity store, statistics, sync data (as they are used) |
| `split_prefs/` | settings as files, when you use them ([Configuration](Configuration.md#settings-as-files-split_prefs)) |
| `passfile` | the first admin's password, when it was made at random or given there |

The files your users upload are wherever their virtual folders point: on the volume only if you put them there. A virtual folder can point at any path in the container (mount another volume, e.g. `-v /srv/files:/files`, writable by uid 65532), at S3, Azure, SMB and the other storage CrushMFT supports.

## Kinds of volume

| | Command | Notes |
|---|---|---|
| Named volume (recommended) | `-v crushmft27:/app/CrushMFT27` | Docker creates it, owned by the image's user. Works everywhere. |
| Host folder | `-v /srv/crushmft27:/app/CrushMFT27` | Easy to see and back up. On Linux the folder must belong to uid 65532: `sudo mkdir -p /srv/crushmft27 && sudo chown 65532:0 /srv/crushmft27`. |
| No volume | none | Docker still makes an anonymous volume (the image declares one), with a random name. Fine for a test; easy to lose. |
| Kubernetes | a PersistentVolumeClaim | the [Helm chart](Kubernetes.md) makes it |

**Network storage** (NFS, SMB/CIFS, Azure Files, EFS) works for the volume if it gives the server's user write access and supports renaming files: CrushMFT and the start program write new files and rename them into place. Keep the volume on storage that is fast for many small files (users, settings, logs); keep large transfer folders separately.

## Ownership

The server runs as **uid 65532, gid 0**. The working folder must be writable by that user, or the container stops at once:

```
CrushContainer: Error: the working folder /app/CrushMFT27 can not be written. A volume mounted there must belong to the image's user, uid 65532 (...)
```

| Case | What to do |
|---|---|
| Named volume | nothing: a new named volume takes the owner of the image's folder (65532) |
| Host folder on Linux | `chown 65532:0 <folder>` (or `chmod` so that 65532 can write) |
| Docker Desktop (Windows, macOS) host folder | nothing: the file sharing maps the owner |
| Kubernetes | `fsGroup: 65532` in the pod's security context (the chart sets it) |
| Another user id (`--user 1000:1000`) | a host folder or a claim that user can write. Docker's named volumes take the owner of the image's folder (65532) while they are empty, so they don't work with another id. |

## Read-only root

The server writes only to the working folder and to `/tmp`, so the rest of the container can be read-only:

```
docker run -d --read-only --tmpfs /tmp -v crushmft27:/app/CrushMFT27 ... crushftp/crushmft27:latest
```

The Kubernetes chart does this by default.

## Backup and restore

The simplest complete backup is the whole volume, taken while the server is stopped:

```
docker stop crushmft27
docker run --rm -v crushmft27:/data:ro -v "$PWD":/backup alpine tar czf /backup/crushmft27-$(date +%F).tgz -C /data .
docker start crushmft27
```

Restore into a new, empty volume:

```
docker volume create crushmft27
docker run --rm -v crushmft27:/data -v "$PWD":/backup alpine sh -c "tar xzf /backup/crushmft27-2026-11-20.tgz -C /data && chown -R 65532:0 /data"
```

Then start the container with that volume. If you only want the settings and users, the important parts are `prefs.XML`, `users/`, `jobs/` and the `ssh_host_*` keys (and `secret.key` with the `-fips` images); the program is put back by the image at the next start.

A backup taken while the server runs is usually fine for `users/` and `jobs/`, but `prefs.XML` can be caught half written; stop the server, or take the newest copy from `backup/`.

## Moving to another host

Back up the volume as above, restore it on the new host, start the same image (or a newer one). Nothing in the volume depends on the host. Keep the SFTP host keys, or SFTP clients will warn that the host key changed.

## One volume, one server

Never run two containers on the same volume at the same time: both would write the same settings and users. More than one server needs CrushMFT's cluster (Enterprise), with one volume each.

## From CrushFTP 11

A CrushFTP 11 container's volume is not converted by the CrushMFT 27 image. Moving from CrushFTP 11 to 27 is an upgrade of the server; see [CrushFTP 11 images](CrushFTP-11.md#moving-to-crushmft-27).
