Volume backups¶
Databases are only part of an application's state: uploads, search indexes and queues live on PersistentVolumes, and an incident that needs a database restore usually needs the files from the same moment. A VolumeTarget protects an application's PVCs in two layers:
- Snapshots (every 15 minutes, kept a day): CSI snapshots inside your storage system. Near-free, restored in seconds.
- Copies (daily, kept 30 days): the files, chunked, deduplicated, compressed and encrypted with your age keys, in your object store. They survive losing the storage system or the whole cluster.
Snapshots are taken and restored by your storage system: Tenax only creates Kubernetes objects and never reads or
writes the data itself. The cluster needs a CSI driver with snapshot support and the snapshot CRDs
(snapshot.storage.k8s.io); without them the target reports SnapshotsUnavailable and takes no snapshots (copies
can still run from the live volume, see below).
Snapshot an application's volumes¶
apiVersion: tenax.run/v1alpha1
kind: VolumeTarget
metadata: { name: files, namespace: shop }
spec:
policy: prod # the BackupPolicy whose time zone applies
selector: { matchLabels: { app: shop } } # or pvcs: [uploads, search-index]
snapshots:
schedule: "*/15 * * * *" # default: every 15 minutes
keep: 24h # default; the newest ready snapshot of each PVC is always kept
# className: csi-snapclass # default: the cluster's default VolumeSnapshotClass
# groupClassName: csi-groupclass # cut every PVC at the same instant, when the driver supports it
TARGET PVC SNAPSHOTS LAST NOTE
shop/files pgdata 0 - belongs to database target shop/orders (point-in-time recovery protects it)
shop/files uploads 96 2026-10-20T14:00:12Z -
PVCs mounted by a database that a BackupTarget already protects are skipped: point-in-time recovery of the
database is better than a crash-consistent copy of its files. Set includeDatabaseVolumes: true to snapshot them
anyway.
Restore a volume¶
A restore creates a new PVC from a snapshot; Tenax never overwrites an existing volume. Pick the newest snapshot at or before a time, or name one:
tenax volumes restore shop/files --pvc uploads --to uploads-restored --at 2026-10-20T14:02:58Z --reason "checkout incident"
The new PVC binds when a pod uses it. Mount it next to the application, copy back what you need, or point the application at it. The same request as a resource:
apiVersion: tenax.run/v1alpha1
kind: VolumeRestore
metadata: { name: uploads-before-incident, namespace: shop }
spec:
target: files
pvc: uploads
time: "2026-10-20T14:02:58Z" # or snapshot: uploads-20261020t140000z
toPVC: uploads-restored
Copy volumes to your object store¶
Copies are on by default. Each run takes the newest ready snapshot of every PVC, clones it into a temporary read-only volume and reads its files:
spec:
copies:
schedule: "0 3 * * *" # default: daily, at a minute derived from the target
keep: 30d # default; the newest copy of each PVC is always kept
deadline: 6h # a copy still running then is stopped and cleaned up
# allowLive: true # no snapshot support: copy the live volume (see below)
# disabled: true
tenax volumes copy shop/files --reason "before the upgrade" # copy now
tenax volumes copies shop/files
PVC COPY AT SOURCE FILES DATA MIN VOLUME UPLOADED
uploads 20261020T030512Z 2026-10-20T03:00:00Z snapshot 48,210 41.2 GiB 43.8 GiB 212.4 MiB
uploads 20261019T030511Z 2026-10-19T03:00:00Z snapshot 48,007 41.0 GiB 43.6 GiB 198.0 MiB
- DATA is the size of the files, uncompressed. MIN VOLUME is the smallest volume the copy can be restored into (files rounded to blocks, directories, filesystem overhead). Use it to size a new PVC, or to see whether several volumes fit in one sandbox.
- UPLOADED is what the copy added to the store. Files are split into content-defined chunks, and a chunk already stored is never uploaded again, so a daily copy of a large, slowly changing volume costs only its changes.
How a copy runs, and why it cannot hang anything:
- A sender pod in the target's namespace mounts the clone read-only. It holds no credentials, cannot reach the network, and accepts one connection: the copier's.
- A copier Job in Tenax's namespace reads the files as a stream, chunks and encrypts them, and uploads packs of chunks in parallel.
- The copy's file index (names, sizes, times, encrypted to your keys and the catalog key) is written, then its manifest, last: a copy exists only once its manifest does.
- The clone and the sender pod are deleted, whatever happened. Both have a hard deadline.
Without CSI snapshots (SnapshotsUnavailable), set copies.allowLive: true to copy the PVC itself while the
application runs. Such a copy is not crash-consistent: files that change while they are read are reported in
the copy's notes.
Browse and compare copies¶
Listing and comparing read only a copy's file index, never its contents:
tenax volumes files shop/files uploads 20261020T030512Z --dir invoices/2026
tenax volumes files shop/files uploads 20261020T030512Z --search .pdf
tenax volumes diff shop/files uploads 20261019T030511Z 20261020T030512Z
3 added (1.2 MiB), 0 removed (0 B), 2 changed (+340.1 KiB), 48005 unchanged
+ +1.1 MiB invoices/2026/10/INV-88412.pdf
~ +320.0 KiB search/segments_4f
A diff is exact: files are compared by their chunk ids, without reading any data.
Look inside a copy: previews, downloads and SFTP¶
You can read files from a copy without restoring over anything. The console and the API never hold the key that
decrypts file contents: a short-lived Job decrypts what you ask for. Previews, downloads and SFTP need the
restorer role, and every link and preview is audited.
tenax volumes files shop/files uploads 20261020T030512Z --dir invoices --sort size --reverse
tenax volumes stat shop/files uploads 20261020T030512Z invoices/2026/10/INV-88412.pdf
tenax volumes preview shop/files uploads 20261020T030512Z logs/app.log
tenax volumes download shop/files uploads 20261020T030512Z invoices/2026/10/INV-88412.pdf
tenax volumes download shop/files uploads 20261020T030512Z invoices/2026 --format tar -o invoices.tar
- Previews show the first 256 KiB of a text file, or a png, jpeg, gif or webp image of up to 4 MiB. Other files are shown as plain text when they are text (SVG and HTML are never rendered) and have no preview otherwise.
- Downloads are one file as it was, or a folder as zip or tar (tar keeps modes, owners and links). The export
Job writes the result to a short-lived object in your store, and you get a signed link that is valid for 15
minutes at most. The object is deleted after 30 minutes (
--ttl, at most 1 hour). Setspec.s3.downloadEncryption: AES256on the BackupStore to have the store encrypt these objects at rest.--linkprints the link instead of downloading: anyone who holds it can download until it expires.
To browse a whole tree with your own tools, open the copy in a volume sandbox. Tenax restores the copy into a temporary volume in a namespace of its own and serves it over read-only SFTP to your SSH key until it expires (default 4 hours):
tenax volumes sftp shop/files uploads # the newest copy, your ~/.ssh/id_ed25519.pub
tenax volumes sftp shop/files uploads 20261020T030512Z --key ~/.ssh/work.pub --ttl 2h
tenax volumes sandboxes
forward: 127.0.0.1:12222 → tenax-vsbx-1a2b3c4d/sftp (kubeconfig)
connect: sftp -P 12222 -o UserKnownHostsFile=/tmp/tenax-known-hosts-123 tenax@127.0.0.1
host key: SHA256:6vZ…
Without a route, the CLI forwards a port through your kubeconfig. With --expose (or Open external access in
the console), the sandbox gets a route through the exposure provider, like a database sandbox. The SFTP server
refuses uploads, deletes, renames, shells and port forwarding, keeps every path inside the volume, and closes
idle connections after 15 minutes. It has no credentials and cannot reach the network.
Restore from a copy¶
After losing the storage system or the cluster, restore from a copy instead of a snapshot. Tenax creates the new PVC (at least the copy's minimum size), starts a receiver pod that mounts it, and a restorer Job streams the files to it. Modes, owners, times and symbolic links come back as they were.
tenax volumes restore shop/files --pvc uploads --to uploads-restored --from copy --at 2026-10-20T03:30:00Z
apiVersion: tenax.run/v1alpha1
kind: VolumeRestore
metadata: { name: uploads-from-s3, namespace: shop }
spec:
target: files
pvc: uploads
from: copy
copy: 20261020T030512Z # or time: "2026-10-20T03:30:00Z"; default the newest
toPVC: uploads-restored
# size: 100Gi # default: the larger of the copy's minimum and the source PVC's size
A size below what the copy needs (or, from a snapshot, below the snapshot's restore size) is refused before any PVC
exists, with the size to use; the VolumeRestore's VolumeFits condition says why.
The PVC may no longer exist in the cluster: the copies in the store are enough. A failed restore deletes the half-filled PVC it created.
What snapshots and copies are and are not¶
- A snapshot is crash-consistent: like pulling the plug at that instant. Applications that need more should pause writes around it. A copy made from a snapshot is exactly that snapshot.
- Snapshots live in the storage system and share its fate. Copies are the disaster-recovery layer.
- Copies hold regular files, directories and symbolic links. Sockets, devices and FIFOs are skipped; hard links come back as separate files.