On this pageWhat an Immich library is made of
Choosing Immich is the easy part; our comparison of Google Photos replacements covers that. Keeping a family's photos safe on it for ten years is the real project. Immich releases often, its database holds everything that makes the library more than a folder of files, and a server can fail on any day. This guide covers what to back up, how Immich's automatic database dumps work, how to prove a restore works, and an upgrade routine for the v3 line, which reached 3.4.1 on November 11, 2026.
What an Immich library is made of
| Part | Location | Back it up? |
|---|---|---|
| Original photos and videos | UPLOAD_LOCATION/library and UPLOAD_LOCATION/upload |
Always |
| Profile pictures | UPLOAD_LOCATION/profile |
Yes |
| Database dumps | UPLOAD_LOCATION/backups |
Yes |
| Thumbnails and transcoded videos | UPLOAD_LOCATION/thumbs and UPLOAD_LOCATION/encoded-video |
Optional, they can be regenerated |
| Live database files | DB_DATA_LOCATION |
Not directly; use the dumps |
| Configuration | .env and docker-compose.yml |
Yes |
Originals sit under library or upload depending on whether the storage template is turned on, so back up both. The database holds everything that is not a file: users, albums, shared links, face groupings, people's names and metadata edits. The files without the database are a pile of photos; the database without the files is a catalog of nothing. Immich's own documentation is explicit that a dump must be used together with a copy of the files from UPLOAD_LOCATION.
The automatic database dumps
Immich writes a dump of its database every day at 2:00 AM into UPLOAD_LOCATION/backups and keeps the last 14. Change the schedule or the number kept under Administration > Settings > Database Dump Settings.
Before anything risky, such as an upgrade or a storage move, take one by hand. In the web interface, go to Administration > Job Queues, choose Create job and then Create Database Dump. From the shell, with the default database name and user from .env:
docker exec -t immich_postgres pg_dump --clean --if-exists \
--dbname=immich --username=postgres | gzip > /srv/backup/immich-$(date +%F).sql.gz
Copy everything off the server
A dump on the same disk protects against mistakes, not against losing the server. Schedule an off-site copy for after the nightly dump, so the files and the database in each backup are from the same night. With restic, assuming UPLOAD_LOCATION=/srv/immich/library and the Compose files in /opt/immich:
export RESTIC_REPOSITORY=sftp:backup@backup.example.com:/srv/restic/immich
export RESTIC_PASSWORD_FILE=/root/.restic-immich
restic backup /srv/immich/library /opt/immich/.env /opt/immich/docker-compose.yml \
--exclude /srv/immich/library/thumbs --exclude /srv/immich/library/encoded-video
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune
Leaving out thumbnails and transcodes keeps the backup to originals plus dumps; Immich rebuilds the rest by rerunning its thumbnail and transcoding jobs, at the cost of CPU time. Back up your data off the server walks through setting up restic. On CloudSat, a snapshot before an upgrade is a quick rollback point, but it lives with the server and does not replace the off-site copy.
Rehearse a restore on a scratch server
A backup you have never restored is a hope. Once, and again after any major change, restore onto a second, temporary server:
- Install Docker, copy
docker-compose.ymland.env, and keepIMMICH_VERSIONat the version the backup came from. - Restore the files into
UPLOAD_LOCATION, for example withrestic restore latest --target /. - Load the database dump with the sequence from Immich's documentation:
cd /opt/immich
docker compose down -v # deletes all Immich data on this server: scratch servers only
docker compose pull
docker compose create
docker start immich_postgres
sleep 10
gunzip --stdout /srv/immich/library/backups/<dump-file>.sql.gz \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| docker exec -i immich_postgres psql --dbname=immich --username=postgres --single-transaction --set ON_ERROR_STOP=on
docker compose up -d
- Sign in and check what matters: an old album, a shared link, a search by a person's name, and a video that plays.
Recent versions can also restore from the web interface, either with Restore from backup on a fresh install's welcome screen or under Administration > Maintenance. The command-line path is still worth knowing, because it works when the interface does not.
Check that backups keep happening
Backups rarely fail loudly. A full disk stops the dumps, an expired SSH key stops the off-site copy, and nobody notices until the day a restore is needed. Two checks catch most of it, and a daily cron job that mails or posts their output is enough:
# a dump from the last 24 hours exists
find /srv/immich/library/backups -name '*.sql.gz' -mtime -1 | grep -q . || echo "No fresh Immich database dump"
# the newest off-site snapshot, with its date
restic snapshots --latest 1
Watch free space as well. Fourteen dumps of a large library's database add up, and Immich cannot write new uploads or thumbnails to a full disk. df -h /srv/immich belongs in the same daily report.
The old rule of thumb still holds: three copies of the photos, on two kinds of storage, one of them somewhere else. For most households, that means the server, a backup repository at another provider, and the phones themselves until the backup has run.
Upgrade without surprises
Immich intends breaking changes only for major releases, but it ships often, so read the release notes for every version you skip. The .env file decides what docker compose pull fetches. The example file sets IMMICH_VERSION=v3, which follows every release in the v3 line; pin an exact version such as v3.4.1 if you want to choose each update yourself.
The routine for every upgrade:
cd /opt/immich
docker exec -t immich_postgres pg_dump --clean --if-exists \
--dbname=immich --username=postgres | gzip > /srv/backup/pre-upgrade-$(date +%F).sql.gz
docker compose pull
docker compose up -d
docker compose logs -f immich-server
docker image prune
Watch the server log until migrations finish and the web interface loads, then open the library on a phone to confirm the app still syncs.
Before moving to v3
- Check the CPU. Since v3, the machine learning container on amd64 needs the x86-64-v2 instruction level, and v2.7.5 is the last release for older processors. On the server,
/lib64/ld-linux-x86-64.so.2 --help | grep x86-64-v2should reportsupported. - Check the starting version. Installs older than v1.133.0 must complete the VectorChord database migration before v3, which also dropped the old pgvecto.rs extension. Move to the last v2 release first, let it run, take a fresh dump, then upgrade to v3.
- Check the memory. Immich asks for at least 6 GB of RAM and 2 cores, with 8 GB and 4 cores recommended, and the database belongs on local SSD storage, never on a network share.
FAQ
Can I back up the PostgreSQL data folder directly?
Not while the stack runs. A copy of a live database directory is often unusable. Use the dumps, or stop Immich completely before copying DB_DATA_LOCATION.
Should thumbnails be in the backup?
They are optional. Immich can regenerate them, but for a very large library the rebuild keeps the server busy for a long time, so backing them up trades disk space for a faster recovery.
Are external libraries included in these backups?
No. External libraries are folders Immich indexes but does not own, mounted from outside UPLOAD_LOCATION, so neither the dumps nor a copy of the upload location contains their files. Back up those folders on their own schedule, and keep their mount paths identical on any server you restore to, or Immich will treat every file as missing.
How do I move Immich to a new server?
Exactly like the restore rehearsal: same version, files into UPLOAD_LOCATION, the latest dump into the database, then start the stack and point your DNS and apps at the new address.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




