Skip to content

Snapshots: back up an app's data

Mesopod keeps your volumes when you stop or uninstall an app. That is not a backup. A backup is a copy in another place. During the beta, you make that copy yourself. This page is the full procedure.

Make a snapshot before you trust an app with data that you would miss, and before each migration.

The script

scripts/snapshot.sh in this repository puts one directory into a tar archive with a timestamp in its name:

snapshot.sh <data-dir> [dest-dir]

Copy the script to the machine with scp, or paste it into a file and run chmod +x on the file. You can also do the same by hand:

sudo mkdir -p /backups
sudo tar czf /backups/photos-$(date +%Y%m%d-%H%M%S).tar.gz -C /srv/photos .

1. Stop the app

In the console, open the app and click Stop. Wait until the status shows stopped.

This step is mandatory for an app with a database. A Postgres or SQLite database writes all the time. A tar archive of its files, made during a write, is not a usable snapshot. You find that out only on the day that you restore it.

2. Find the directory

Host directory volumes. The console shows the directory on the volume's page. It is the path that you typed when you created the volume. That is the path on the machine. There is nothing to look up.

Volumes that Mesopod created, on a cluster whose volumes cell on the Clusters page shows a path, for example /…/volumes/<cluster-slug>. The install moved app storage into your data directory (How the install works). Open the volume's page in the console. The page names the directory under that path, with a copy button. That is the path on the machine. On a Mac, you can read it without sudo.

A cluster whose volumes cell shows in the cluster's own storage, or a cluster installed before the data directory existed. The volume's page names no directory. Ask the cluster where the volumes are:

sudo k3s kubectl get pv \
  -o custom-columns=NAME:.metadata.name,PATH:.spec.local.path,NS:.spec.claimRef.namespace,CLAIM:.spec.claimRef.name

Each app runs in its own namespace. The NS column tells you which rows belong to the app. PATH is a real directory on the machine.

3. Make the snapshot

The destination directory must exist. Neither the script nor tar creates it:

mkdir -p ~/Backups
./snapshot.sh ~/Mesopod/volumes/basement-nuc/pvc-1234…_photos-ns_pvc-5678… ~/Backups

On a cluster that kept its own storage, the directory is under /var/lib/rancher/k3s/storage/, and sudo is necessary to read it.

The script prints the name of the archive that it wrote. Copy that archive off the machine. A snapshot that exists only on the disk that you protect is not a backup. Use an external drive, another machine or object storage. Any of them is good, if it is not this machine.

4. Start the app again

Click Start in the console. Make sure that the status returns to running before you leave.

Restore a snapshot

Caution: Make sure that <dir> is the volume's directory before you empty it. The command in step 2 deletes everything in it.

  1. Click Stop on the app in the console.
  2. Empty the volume's directory: sudo rm -rf <dir>/*.
  3. Extract the snapshot into the directory: sudo tar xzf photos-20260919-101500.tar.gz -C <dir>.
  4. If the app runs as a non-root user and your tar did not keep the ownership, correct it: sudo chown -R <uid>:<gid> <dir>.
  5. Click Start.

To restore into a different app instance, use the same steps: create the instance, stop it, replace the directory, start it.

Migrate an app onto Mesopod

The rule during the beta:

  1. Make a snapshot of the data on the old runtime before you move anything.
  2. Bring the data into Mesopod as a host directory volume, or restore a snapshot into a Mesopod volume.
  3. Keep the old runtime startable. Do not delete the old Compose file, its volumes or the VM until you trust the app on Mesopod. Each migration then stays reversible.

What this does not cover yet

Scheduled backups, off-site replication and app-aware dumps (pg_dump, for example) are not available yet. For now, the procedure is a stopped app, a tar archive and a copy in another place.