Backup via SSHFS

Hi, I ran in some trouble using restic to back up some data from my NAS.
But first some information about the environment
my NAS run a restic rest server where my Workstations store their backups. (this works fine, backing up and restore are tested fine)
As a 2nd instance of backup, I want us a Raspberry Pi 4 with 2 USB HDDs. The Pi is controlled by a time switch to power on once a week and run the backup as a cron.
I use a bash script to run the restic commands in the cron

restic --repository-file "/home/genchan/.tar_karl" -p "/home/genchan/.restic_karl" unlock
restic --repository-file "/home/genchan/.src_simon" --insecure-tls --cache-dir="/mnt/UserData" --password-file "/home/genchan/.restic_simon" copy --from-repository-file "/home/genchan/.tar_karl" --from-password-file "/home/genchan/.restic_karl"
restic --repository-file "/home/genchan/.src_karl" --insecure-tls --cache-dir="/mnt/UserData" --password-file "/home/genchan/.restic_karl" copy --from-repository-file "/home/genchan/.tar_karl" --from-password-file "/home/genchan/.restic_karl"
restic --repository-file "/home/genchan/.tar_simon" -p "/home/genchan/.restic_simon" forget --keep-within-weekly 1m --prune
restic --repository-file "/home/genchan/.tar_karl" -p "/home/genchan/.restic_karl" forget --keep-within-weekly 1m --prune

This part works totally fine. Now I want to add a backup of some data from the NAS itself. It’s about 1TB of media files of the local DLNA service, local web radio and this kind of stuff.
I think an easy way to get the job done is to run restic backup at the Raspberry. I mount the directory to back up from the NAS via sshfs (via fstab)
media@192.168.1.99:/mnt/Multimedia /mnt/nas fuse.sshfs default_permissions,noauto,x-systemd.automount,_netdev,IdentityFile=/home/genchan/.ssh/id_rsa,allow_other,reconnect 0 0
now I tried some variations to back up the full mounting point /mnt/nas
At first, I tried the same command as I run on my workstations:
sudo restic --repository-file "/home/genchan/.repo_media" --cache-dir="/mnt/Multimedia" -p "/home/genchan/.restic_media" --files-from "/home/genchan/.backup_media" backup
repository-file = /mnt/Multimedia
for testing, I added not all directories to the .backup_media, only about 30gb. First time a full backup is preforming, but on 2nd execution I also preform a full backup (time to execute all time about 20 min). And before the question comes up, yes restic reports using parent snapshot […]
after some reading, I tried another way
sudo restic --repository-file "/home/genchan/.repo_media" --cache-dir="/mnt/Multimedia" -p "/home/genchan/.restic_media" --exclude-file "/home/genchan/.backup_media" backup /mnt/nas
this time I excluded some directories to get the same 30gb for testing. I got the same issue as in my first try.
I think it could have something to do with the mounting via sshfs, but II have no idea how to fix this. Has someone some ideas on this?

PS: I do some test that confuses me a bit more. I have about 10 directories in /mnt/nas, all are in the exclude file and I use # to add them to the back up one by another. At this moment I got about 2 gb in 3 directories. If I run it twice it works fine but if I wait about 30 min

I don’t use SSHFS so this is just a vague guess, but check out the --ignore-inode and perhaps also --ignore-ctime options of the backup command. Perhaps the inodes change when you mount the SSHFS and this causes restic to see the files as needing to be scanned.

You should also show us the output of the backup run where you expect restic to not have much changes to back up, so we can see what it says about it.

1 Like

Thanks for this hint. It seems to work now. I only have done a few testings but no issue at this point.
I have added --ignore-inode

1 Like

Yeap, this has fixed the issue. I have done further testings and never get the problem again. Thanks a lot

2 Likes

Thanks for getting back and verifying the solution!