r/immich • • 1d ago

Immnich backup

Hi, Any advice how to backup my Immnich server?

I plan to build a 2nd Immnich at my parents and somehow to sync the photos from my house and their house. Even geograhpically is only 5km away (so is not proof to natural disasters) should be ok

5 Upvotes

24 comments sorted by

11

u/thehatefuleggplant Support Crew 1d ago

Just an fyi immich doesnt have a mechanism for HA so if youre wanting two identical instances you wont find a solution here.

Im sure there is a way to do this via a Kubernetes or docker swarm but then youre getting into a whole new realm of fun and joy.

As a off site backup you could use anything like sync thing or backrest (i would suggest backrest)

10

u/middaymoon 1d ago

Don't set up a second Immich instance. Just run the automatic backups and perhaps backup that directory to the second server.

6

u/m3zz1n 1d ago

Imnich makes a backup if setup every day of the db and you only need to sync the folders i sync to proton and sync to a second nas for backup.

5

u/False-Try-3521 1d ago

I use Zerobyte as Restic GUI and backup Immich daily to cloud storage. From time to time I test some backups by downloading them and trying a restore to verify.

4

u/Professional-Buy1238 1d ago

Use Duplicati, set it and forget.

6

u/Distinct_Whereas_264 1d ago

Until you need to restore a backup and realize the database is corrupt.

Any backup system must be tested frequently.

3

u/conectionist 1d ago

Has this happened to you?

I'm using Duplicati myself and I just felt a shiver down my spine. 😅 

2

u/xman_111 1d ago

it used to be a thing, when I read it, I didn't consider duplicati any longer. things may have changed but I would test a large sample restore.

2

u/wells68 1d ago

I ran Duplicati several years ago as a secondary backup for a couple of offices. I replaced it a few weeks later after 1) several corrupted database incidents, and then 2) reading about others who had similar issues.

To be fair, they've put in a lot of work since then. But have they changed or remediated the underlying database vulnerability (the non-adversary type)?

2

u/g33kmk 1d ago

Happened to me in 2 different occasions... First time I found out during a recovery process, and wasn't able to recover some files. After that, learning about the issues, I set up a full backup verification, so the second time I found out about it through a verification process. After a botched update process a week or two ago, Duplicati no longer even starts for me, and I gave up on fixing it. Highly disappointed...

1

u/Nurgus 1d ago

You can't backup the files of a live database without either stopping the database or using a snapshot.

Inconsistency is like database file cancer.

3

u/Puzzled_Way_8570 1d ago

I've self hosted Restic and perform daily backups which pushes them to a Hetzner storage box

2

u/ChipsAhoy2022 1d ago

I think what the original intention of the question was how to create a backup of all media assets on a separate location other than the main immich hard drive

I am also looking for the same since my current immich lives on a HDD and I’m starting to worry about drive failure and data loss

2

u/CurrentManner 1d ago

Tailscale + Restic + Nightly Backups

2

u/c00750ny3h 1d ago

If you are on docker,

Run a database dump job, then copy paste the folder specified in the UPLOAD_LOCATION environment variable to another drive or something.

2

u/ComputersGoBrr 1d ago

The official documentation has good information on what you need to backup-
https://docs.immich.app/administration/backup-and-restore/

I personally use restic to snapshot immich- and prune- keeping 7 day, 4 week, 12 month.
I don't backup the thumbs or encoded-video as it can be re-generated.

~/scripts/immich/.env

export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"
export RESTIC_REPOSITORY="s3:https://s3.us-west-002.backblazeb2.com/your-bucket-name/restic"
export RESTIC_PASSWORD="your_secure_password_here"

~/scripts/immich/backup-immich-restic.sh

#!/bin/bash
# load our secrets
source /home/yadavravindra/scripts/immich/.env
# backup
restic backup /immich \
    --exclude /immich/thumbs \
    --exclude /immich/encoded-video \
&& restic forget \
    --keep-daily 7 \
    --keep-weekly 4 \
    --keep-monthly 12 \
    --prune

You should chmod 600 ~/scripts/immich/.env.

And make the script executable chmod +x ~/scripts/immich/backup-immich-restic.sh.

Then you can have it run each day on your cron. This example will run at 3am every day.

crontab -e

0 3 * * * /home/user/scripts/immich/backup-immich-restic.sh

Backrest is a good GUI option for restic if this seems too daunting.

Good luck!

2

u/Obvious-Heron9799 1d ago

I did post two weeks ago or so my little backup-project (as I wanted to get away from CLI as much as possible).

https://github.com/someone303-pixel/immich-backup-manager

This will backup the Database as well as the actual content and take care about the immich version (sanity check) before restoring.

May be useful for others... it works for me.

2

u/kapucheeno 1d ago

I have Kopia backup (snapshot) the immich library dir every night. Then sync to Backblaze B2

2

u/winston161984 1d ago

I use syncthing to just sync my data drives to the backup box at my parents house - I have it mounted and just check every so often that the pictures are there. If something ever happens to my main system I would just mount the backup drive as an "external library" and move on.

2

u/sly870 1d ago

0

u/spamoi 1d ago

Ça c’est pour sauvegarder la DB, mais pour les photos y’a rien, c’est demerde toi !

«Immich does not handle filesystem backups for you. You have to arrange these yourself! »

Perso j’utilise Duplicacy (non je n’ai pas fait de faute :)) , mais il faut surveiller que tout se passe bien.

C’est un des points noirs sur Immich je trouve, mais j’imagine qu’ils travaillent dessus…

2

u/FotoFirst 1d ago

To set up a disaster-resilient Immich deployment on Proxmox, the best architecture is to run Immich inside a lightweight Proxmox LXC container, store its photo library on an unprivileged bind mount, and use Proxmox Backup Server (PBS) to encrypt and replicate those backups to an offsite location.

1

u/Mr_Irvington 1d ago

My immich is on my Proxmox server and I back it up weekly.

1

u/Sir_Neo 1d ago

Thank you everyone for advices. I will see what suits me better from the comments!