SFTP backup not showing up, where is my repository?

Hey,

I just switched to restic and am trying to sent it up with SFTP, in general I’m trying to backup a cloud server (running Ubuntu) to my local NAS (Synology). Right now I can log in via SSH from my cloud server into my local NAS via ssh keys and everything is working as expected.

My problem is that I set up a new SFTP repository like this, set the password and it all seemed good.

restic -r sftp:user@user.example.com:/volume1/Archive/backup-remote/backup-2019 init --verbose

When I do the backup like:

restic -r sftp:user@user.example.com:/volume1/Archive/backup-remote/backup-2019 backup --files-from /home/ubuntu/.config/restic/includes --exclude-file=/home/ubuntu/.config/restic/excludes --verbose

It runs through as expected:

restic -r sftp:user@user.example.com:/volume1/Archive/backup-remote/backup-2019 backup --files-from /home/ubuntu/.config/restic/includes --exclude-file=/home/ubuntu/.config/restic/excludes --verbose
open repository
enter password for repository:
repository 57eff208 opened successfully, password is correct
lock repository
load index files
using parent snapshot a2c559ad
start scan on [/etc]
start backup on [/etc]
[snip]
Files:           0 new,     0 changed,  1311 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      1 new
Added to the repo: 352 B

processed 1311 files, 2.752 MiB in 0:02
snapshot 153ffe86 saved

But when I’m checking my NAS the directory I set up the repository it’s empty, so even though the initial setup worked it didn’t create any config directory or set up the repository it seems. It also didn’t give me any errors.

What I tried:

  1. Create a new repository
Fatal: create repository at sftp:user@user.example.com:/volume1/Archive/backup-remote/backup-2019 failed: config file already exists

Why does it say it exists when it actually doesn’t? How can I remove the config file? Why does the setup of the repository work when there’s nothing in the remote repository?

  1. List blogs in repository

To try if my repository works I tried listing the blobs, which worked:

restic -r sftp:user@user.example.com:/volume1/Archive/backup-remote/backup-2019 list blobs
enter password for repository:
repository 57eff208 opened successfully, password is correct
data 64ced10406ec4dac5ebacbfa966dc20de42b748bef7511aec405d4559f77602e
[snip]

I’m very confusing where it gets this data from when the repository is not on the remote server :thinking:

Thankful for any pointers!

If the filesystem on your NAS does not contain any files even though you’re getting a successful run with restic, then I’d say that’s probably a problem on the NAS side.

To isolate it to one side of the SFTP channel, you can try to connect using regular sftp on the client where you run restic. If you can then list the files, you need to look at the NAS and see where they might have gone. Perhaps they’re stored somewhere else than you think (on the NAS)?

1 Like

The most logical explanation, then, is that you’re looking in the wrong directory.

What is the output of this command?

restic -r sftp:... snapshots -c

Thanks for the quick responses, I was very confused by this issue and as it turns out it’s a bit Synology’s fault as SFTP behaves very differently than SSH as I found out through their documentation just now.

I just connected via SFTP to the NAS with the same credentials as I used in restic and as it turns out it sets the home directory actually as it’s root directory ("/") so when I created the repository in:

sftp:user@user.example.com:/volume1/Archive/backup-remote/backup-2019

It actually created the directory /volume1/Archive/backup-remote/backup-2019 in the home directory, via SSH the path would be:

/volume1/Archive/backup-remote/backup-2019 but via SFTP it’s /home/myuser/volume1/Archive/backup-remote/backup-2019. In there I found the correct config files and everything as I expected.

The fix was now to delete that /volume1/... directory in my home directory and create a new repository via:

restic -r sftp:user@user.example.com:/backup-remote/backup-2019 init

I hope this helps other Synology + Restic users.

Thanks for your responses in here too!

2 Likes

Thanks for the elaborate follow-up, it might very well help other users! I’ve marked your last post as a solution, so it’s easy to find/spot.

1 Like