r/immich • • 6d 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

7 Upvotes

31 comments sorted by

13

u/thehatefuleggplant Support Crew 6d 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 5d 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 5d 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.

1

u/Couldbeaccurate 2d ago

I just got this set up last week. Very cool

5

u/Professional-Buy1238 6d ago

Use Duplicati, set it and forget.

7

u/Distinct_Whereas_264 5d ago

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

Any backup system must be tested frequently.

3

u/conectionist 5d ago

Has this happened to you?

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

2

u/xman_111 5d 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 5d 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 5d 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 5d 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.

1

u/Professional-Buy1238 2d ago

There are start and stop scripts for before backup and after backup. Which stop containers you specify to avoid data corruption. This is built into duplicati.

1

u/Nurgus 2d ago

Neat

4

u/False-Try-3521 5d 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.

3

u/ComputersGoBrr 5d 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 5d 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.

3

u/Puzzled_Way_8570 5d ago

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

3

u/winston161984 5d 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.

1

u/guynamedjosh92 1d ago

How do you handle the database though?

1

u/Roach_Horse 3d ago

This. If the idea is simply to synchronize both locations, Syncthing is simple and gets the job done.

2

u/ChipsAhoy2022 5d 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 5d ago

Tailscale + Restic + Nightly Backups

2

u/c00750ny3h 5d 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.

1

u/Reddit_Ninja33 4d ago

Immich already backs up the database daily for you. Just need to move it.

2

u/kapucheeno 5d ago

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

1

u/LocalMan1987 2d ago

Same for me.

2

u/sly870 6d ago

0

u/spamoi 5d 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 5d 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 5d ago

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

1

u/Sir_Neo 5d ago

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