--- type: reference title: Gitea Data Persistence description: Gitea data persistence, volume mounts, ownership, and backup strategy on dankclaw. tags: - gitea - data - unverified verified: 2026-08-28 --- # Gitea Data Persistence All data lives on host bind mounts under `/opt/gitea/data/`. Containers are ephemeral. Quadlet stops remove the container (`podman run --rm --replace`). The next start recreates it. Data survives. ## Volume Layout | Host Path | Container Mount | Contents | |---|---|---| | `/opt/gitea/data/gitea-gitea/` | `/data` | Git repositories, avatars, attachments, LFS objects, `app.ini` | | `/opt/gitea/data/gitea-postgres/` | `/var/lib/postgresql/data` | PostgreSQL WAL, tables, indexes | ## Ownership The bind-mount directories are owned by host user `dank` (UID 1000). Files that the containers create are owned by host UID/GID **100999** — the rootless ID mapping of container uid/gid 1000 (dank subuid range 100000-165535). User `dank` cannot write those files directly from the host. Edit container-owned files inside the container: ``` podman exec --user 1000 gitea-server sed -i 's/old/new/' /data/gitea/conf/app.ini ``` ## Backup Strategy ### Full backup (recommended) Tar the entire data directory. This captures Gitea repos and PostgreSQL data in one archive. ``` tar czf gitea-backup-$(date +%F).tar.gz -C /opt/gitea data/ ``` ### PostgreSQL-only backup Use `pg_dump` for a portable SQL dump. Useful for restoring to a different PostgreSQL version. ``` podman exec -e PGPASSWORD="$GITEA_DB_PASSWORD" gitea-postgres pg_dump -U gitea gitea > gitea-db-$(date +%F).sql ``` Set `PGPASSWORD` from `/opt/gitea/.env` (mode 0600). ### Restore procedure 1. Stop the stack: `systemctl --user stop gitea-server gitea-postgres` 2. Restore data: `tar xzf backup.tar.gz -C /opt/gitea/` 3. Start the stack: `systemctl --user start gitea-postgres gitea-server` ## Data Growth - Git repositories grow with each commit and push. Monitor with `du -sh /opt/gitea/data/gitea-gitea/git/repositories/`. - PostgreSQL WAL files accumulate. VACUUM via `podman exec gitea-postgres psql -U gitea -c "VACUUM;"`. - Gitea's log files grow with usage. ## See Also - ](index.md) — index with management commands - [[management|management]] — operations and boot persistence - [[architecture|architecture]] — network and ports