December 3, 2025Dec 3 Spent two full days trying to find the "right" backup solution.Seems running an rsync script or two will do the job.This is the script I have:#!/bin/bash#rsync -avh --progress /mnt/user/Photos/profile /mnt/disks/Recovery/Immich/#rsync -avh --progress /mnt/user/Photos/library /mnt/disks/Recovery/Immich/#rsync -avh --progress /mnt/user/Photos/upload /mnt/disks/Recovery/Immich/rsync -avh --progress /mnt/user/Photos/backups /mnt/disks/Recovery/Immich/--But as a test on just one line, the last I get several errors: IE. failed: Operation not permitted.--But I do get this output in the correct directory. immich-db-backup-20251202T160000-v2.3.1-pg16.8.sqlWhat am I doing wrong? --The /mnt/disks/Recovery/Immich/ is a mounted flash drive.Script location: /tmp/user.scripts/tmpScripts/Backup Immich Profile/scriptNote that closing this window will abort the execution of this script sending incremental file listrsync: [generator] chown "/mnt/disks/Recovery/Immich/backups" failed: Operation not permitted (1) backups/backups/.immich 13 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3) backups/immich-db-backup-20251202T160000-v2.3.1-pg16.8.sql.gz 32.77K 0% 31.25MB/s 0:00:02 rsync: [receiver] chown "/mnt/disks/Recovery/Immich/backups/.immich.gVITnG" failed: Operation not permitted (1) 80.90M 100% 1015.14MB/s 0:00:00 (xfr#2, to-chk=0/3) rsync: [receiver] chown "/mnt/disks/Recovery/Immich/backups/.immich-db-backup-20251202T160000-v2.3.1-pg16.8.sql.gz.pFxnF9" failed: Operation not permitted (1) sent 80.92M bytes received 58 bytes 161.84M bytes/sec total size is 80.90M speedup is 1.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.4.1] Edited December 3, 2025Dec 3 by RaidPC Clarification
December 16, 2025Dec 16 How is your mounted flash-drive formatted? If it is formatted in exFat or FAT then (i think) 'chown' won't work.I too use immich and i make a backup of all my immich-containers: postresql, redis, immich-appdata and immich-userdata. It is best to stop the containers when making a backup otherwise the immich database can become corrupted. I use this script to backup my immich instance:#!/bin/bash # ========================================================== # Immich Backup Script voor Unraid met logging + rotatie # ========================================================== # Configuratie MAC_ADDRESS="macadressofbackuppc" INTERFACE="eth0" REMOTE_IP="ipadressofbackuppc" MAX_WAIT=15 LOGDIR="/var/log" LOGFILE="$LOGDIR/immich_backup.log" CONTAINERS=("immich" "PostgreSQL_Immich" "redis") # ---------------------------------------------------------- # Logrotatie: houd max. 2 logs (immich_backup.log en .1) # ---------------------------------------------------------- mkdir -p "$LOGDIR" if [ -f "$LOGFILE" ]; then if [ -f "$LOGFILE.1" ]; then rm -f "$LOGFILE.1" fi mv "$LOGFILE" "$LOGFILE.1" fi # ---------------------------------------------------------- # Logging functie # ---------------------------------------------------------- log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOGFILE" } log "==================== START BACKUP ====================" log "Wakker maken van remote server ($MAC_ADDRESS)..." etherwake -i "$INTERFACE" -b "$MAC_ADDRESS" | tee -a "$LOGFILE" log "Wachten tot de server online komt..." WAITED=0 while ! ping -c 1 -W 1 "$REMOTE_IP" > /dev/null 2>&1; do sleep 1 WAITED=$((WAITED + 1)) if [ "$WAITED" -ge "$MAX_WAIT" ]; then log "FOUT: Server is niet online gekomen binnen $MAX_WAIT seconden." exit 1 fi done log "Server is online!" # ---------------------------------------------------------- # Containers stoppen # ---------------------------------------------------------- log "Containers stoppen..." for NAME in "${CONTAINERS[@]}"; do log "Stop container: $NAME" docker stop "$NAME" >> "$LOGFILE" 2>&1 sleep 5 done # ---------------------------------------------------------- # Back-ups uitvoeren # ---------------------------------------------------------- log "Start Immich backup..." rsync -avh --delete /mnt/user/appdata/immich/ root@$REMOTE_IP:/mnt/user/backup/appdata/immich/ | tee -a "$LOGFILE" rsync -avh --delete /mnt/user/appdata/PostgreSQL_Immich/ root@$REMOTE_IP:/mnt/user/backup/appdata/PostgreSQL_Immich/ | tee -a "$LOGFILE" rsync -avh --delete /mnt/user/appdata/redis/ root@$REMOTE_IP:/mnt/user/backup/appdata/redis/ | tee -a "$LOGFILE" rsync -avh --delete /mnt/user/immich/ root@$REMOTE_IP:/mnt/user/backup/immich/ | tee -a "$LOGFILE" log "Backup van Immich voltooid." # ---------------------------------------------------------- # Containers opnieuw starten (omgekeerde volgorde) # ---------------------------------------------------------- log "Containers opnieuw starten..." for (( idx=${#CONTAINERS[@]}-1 ; idx>=0 ; idx-- )) ; do NAME="${CONTAINERS[idx]}" log "Start container: $NAME" docker start "$NAME" >> "$LOGFILE" 2>&1 sleep 15 done log "Containers succesvol opgestart." log "==================== BACKUP KLAAR ====================" Wakes up the backup-server and checks if it is online.All containers are stopped in a specific order (immich, postgresql, redis).Then the actual backup is made.Containers are restarted in the reverse order (redis, postgresql, immich).Logs are /var/logs/...This script can probabely be improved but it works for me.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.