---
title: "Back up, restore and upgrade Immich without losing photos · CloudSat"
description: "Protect an Immich library: what to back up, how the automatic database dumps work, how to rehearse a restore, and a safe upgrade routine for Immich v3."
url: https://cloudsat.io/learn/immich-backups-restores-and-safe-upgrades
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Self-hosting](https://cloudsat.io/learn/topic/self-hosting)

# Back up, restore and upgrade Immich without losing photos

Protect an Immich library: what to back up, how the automatic database dumps work, how to rehearse a restore, and a safe upgrade routine for Immich v3.

CloudSat team November 18, 2026 6 min read

Choosing Immich is the easy part; our [comparison of Google Photos replacements](https://cloudsat.io/learn/self-hosted-google-photos-replacement) 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`:

```bash
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`:

```bash
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](https://cloudsat.io/docs/backup-your-data) walks through setting up restic. On CloudSat, a [snapshot](https://cloudsat.io/docs/take-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:

1. Install Docker, copy `docker-compose.yml` and `.env`, and keep `IMMICH_VERSION` at the version the backup came from.
2. Restore the files into `UPLOAD_LOCATION`, for example with `restic restore latest --target /`.
3. Load the database dump with the sequence from Immich's documentation:

```bash
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
```

1. 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:

```bash
# 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:

```bash
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-v2` should report `supported`.
- **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](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Self-hosting](https://cloudsat.io/learn/topic/self-hosting)

- [Leaving Google Photos: self-hosted libraries compared](https://cloudsat.io/learn/self-hosted-google-photos-replacement): Self-hosting Leaving Google Photos: self-hosted libraries compared 6 min read
- [Nextcloud vs ownCloud, and the lighter alternatives](https://cloudsat.io/learn/choose-a-self-hosted-file-sync-platform): Self-hosting Nextcloud vs ownCloud, and the lighter alternatives 6 min read
- [Install Nextcloud on Ubuntu: All-in-One or manual](https://cloudsat.io/learn/install-nextcloud-on-ubuntu-aio-or-manual): Self-hosting Install Nextcloud on Ubuntu: All-in-One or manual 7 min read
- [Run a self-hosted newsletter with listmonk](https://cloudsat.io/learn/run-a-newsletter-on-listmonk): Self-hosting Run a self-hosted newsletter with listmonk 6 min read
