Backups & restore
LabPod backs up its SQLite database - workspaces, users, workspace templates, policies, audit logs, and settings. Scheduled and manual snapshots protect only the database. Research files, workspace homes, workspace definitions, template build contexts, and installation configuration live outside it; back them up separately with your host-level backup tool. See What database snapshots do not cover.
For the saved recipe and settings format, see Workspace definition files.
Daily backup timer
Section titled “Daily backup timer”The install script registers labpod-backup.timer, which runs once a day with a randomized
delay and calls:
labpod admin backup --retention 14This creates a timestamped snapshot (labpod-YYYYMMDDTHHMMSSZ.db) and keeps the 14 most
recent, pruning older ones. By default it uses /var/lib/labpod/backups; set
LABPOD_BACKUP_DIR in /etc/labpod/labpod.env to move both scheduled backups and installer
recovery artifacts together.
# Inspect the timersudo systemctl list-timers labpod-backup.timer
# Check recent backup logssudo journalctl -u labpod-backup.service --since today
# List existing backupsls -lah /var/lib/labpod/backups/# Run these as root# Inspect the timersystemctl list-timers labpod-backup.timer
# Check recent backup logsjournalctl -u labpod-backup.service --since today
# List existing backupsls -lah /var/lib/labpod/backups/Force a snapshot now:
sudo systemctl start labpod-backup.service# Run these as rootsystemctl start labpod-backup.serviceTune retention or directory
Section titled “Tune retention or directory”Set a directory in the environment file and create it as root:
(set -euo pipefailsudoedit /etc/labpod/labpod.env# Add or change: LABPOD_BACKUP_DIR=/srv/labpod/backupssudo install -d -m 0750 /srv/labpod/backups)# Run these as root(set -euo pipefail${EDITOR:-vi} /etc/labpod/labpod.env# Add or change: LABPOD_BACKUP_DIR=/srv/labpod/backupsinstall -d -m 0750 /srv/labpod/backups)labpod-backup.service runs under a ProtectSystem=strict sandbox that only allows writes to the
paths listed in its unit’s ReadWritePaths. Editing LABPOD_BACKUP_DIR alone does not update that
list, so relocating the directory (or tuning retention) needs a drop-in:
sudo systemctl edit labpod-backup.service# Run these as rootsystemctl edit labpod-backup.serviceIn the editor, paste:
[Service]ExecStart=ExecStart=/usr/local/bin/labpod admin backup --retention 30ReadWritePaths=/var/lib/labpod /srv/labpod/backupsDrop the ReadWritePaths line if you’re only tuning retention and keeping the default directory.
(set -euo pipefailsudo systemctl daemon-reloadsudo systemctl restart labpod-backup.timer)# Run these as root(set -euo pipefailsystemctl daemon-reloadsystemctl restart labpod-backup.timer)Ad-hoc backup
Section titled “Ad-hoc backup”Write a self-contained snapshot to an explicit path:
sudo labpod admin --db /var/lib/labpod/labpod.db backup --out /tmp/labpod-adhoc.db# Run these as rootlabpod admin --db /var/lib/labpod/labpod.db backup --out /tmp/labpod-adhoc.dbThis fails fast if the database file doesn’t exist (no silent empty-DB creation).
Restore
Section titled “Restore”Restore requires stopping the service because SQLite refuses a hot copy when the WAL sidecar
(.db-wal, .db-shm) is in use.
(set -euo pipefailsnapshot="/var/lib/labpod/backups/labpod-20260517T030000Z.db"sudo test -f "$snapshot"sudo test -s "$snapshot"sudo systemctl stop labpod
sudo labpod admin --db /var/lib/labpod/labpod.db restore \ "$snapshot"
sudo systemctl start labpod)# Run these as root(set -euo pipefailsnapshot="/var/lib/labpod/backups/labpod-20260517T030000Z.db"test -f "$snapshot"test -s "$snapshot"systemctl stop labpod
labpod admin --db /var/lib/labpod/labpod.db restore \ "$snapshot"
systemctl start labpod)restore will prompt for confirmation unless you pass --yes.
What the backup contains
Section titled “What the backup contains”The backup is a complete snapshot of the LabPod database:
- Users, roles, and hashed passwords
- Workspace records, start history, and GPU allocations
- Workspace templates and their port/env configuration
- Resource policies and system settings
- Session records and audit logs
- Usage samples and rollups
Not included: anything outside the database file, listed below. Running state - kernels, unsaved notebooks, training progress since the last checkpoint - is never captured.
What database snapshots do not cover
Section titled “What database snapshots do not cover”Back up these file sets separately, preferably to storage independent of the LabPod host, and regularly test restoring them together with a database snapshot taken at the same time:
| What | Default location |
|---|---|
| Research and work files (notebooks, datasets, checkpoints, environments) | <passwd-home>/work, or <LABPOD_WORK_BASE>/<user>/work when configured |
| Persistent workspace homes, including archives of deleted workspaces | <passwd-home>/workspaces/ |
| Workspace definitions (each workspace’s saved recipe and settings) | <passwd-home>/.config/labpod/workspaces/ |
| Editable workspace-template build contexts | <user-work>/.labpod/context/ |
| Imported workspace-template contexts | /var/lib/labpod/builds/template-imports/ |
| Installation configuration | /etc/labpod/ (including labpod.env), systemd units and drop-ins, TLS and license files |
Container images can usually be downloaded again from their registry or rebuilt from a saved
recipe; keep your own copy of any image you could not reproduce. Writable container layers are not
backed up: Stop removes them, so save anything valuable to /work or the workspace home first.
The installer’s pre-upgrade-* recovery sets in the backup directory are a separate mechanism.
Each one keeps the previous executable, application files, and a paired database snapshot for
upgrade rollback (see Upgrades). They are not part of the daily rotation
and do not replace configuration or workspace-data backups.
Recovering a complete installation
Section titled “Recovering a complete installation”Recovering workspaces needs the database and the file sets above from one quiet point in time. To make such a set:
- Arrange a maintenance window. Owners save notebooks and checkpoints and stop their workspaces (root can force-stop); finish or cancel image builds and pending creates.
- Stop the backup timer, wait for a running backup to finish, then stop LabPod.
- Take a database snapshot, then copy the file sets while preserving numeric ownership,
permissions, hard links, ACLs, and extended attributes (for example with
rsync -aHAX --numeric-ids). Record checksums and store the set off the host. - Start LabPod and the backup timer again.
(set -euo pipefailsudo systemctl stop labpod-backup.timerstate=$(systemctl is-active labpod-backup.service) || [ "$?" -eq 3 ][ "$state" = inactive ]sudo systemctl stop labpodsudo labpod admin --db /var/lib/labpod/labpod.db backup --out /mnt/recovery/labpod-set/labpod.db)# Run these as root(set -euo pipefailsystemctl stop labpod-backup.timerstate=$(systemctl is-active labpod-backup.service) || [ "$?" -eq 3 ][ "$state" = inactive ]systemctl stop labpodlabpod admin --db /var/lib/labpod/labpod.db backup --out /mnt/recovery/labpod-set/labpod.db)To restore, first recreate the Linux accounts with the same numeric UID/GID, groups, and HOME.
Restore the files to their recorded locations without merging them into existing data, restore the
database with labpod admin restore, then start LabPod. Each owner then reviews their workspace
settings, explicitly downloads or builds the image if needed, and starts the workspace. A recovered
workspace starts as a fresh container from its saved files; it does not resume old processes.
Rehearse the procedure on an isolated host before relying on it.