--- type: reference title: Gitea Data Persistence description: Gitea data persistence, volume mounts, ownership, and backup strategy on dankclaw (Containers/gitea layout). tags: - gitea - data verified: 2026-10-18 --- # Gitea Data Persistence All data lives on host bind mounts under `/home/dank/Containers/gitea/` (fleet storage standard since 2026-09-01; quadlet units re-pointed from the old `/opt/gitea/data/` tree, which lingers on disk as a leftover — never write to it). 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 | |---|---|---| | `/home/dank/Containers/gitea/data/` | `/data` (gitea-server) | Git repositories, avatars, attachments, LFS objects, `app.ini` | | `/home/dank/Containers/gitea/postgres/` | `/var/lib/postgresql/data` (gitea-postgres) | 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 /home/dank/Containers/gitea data/ postgres/ ``` ### 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 `/home/dank/Containers/gitea/env` (mode 0600, `GITEA_DB_PASSWORD`). ### Restore procedure 1. Stop the stack: `systemctl --user stop gitea-server gitea-postgres` 2. Restore data: `tar xzf backup.tar.gz -C /home/dank/Containers/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 /home/dank/Containers/gitea/data/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