Can't get syntax right for remote backup

Hi,

first off: Thanks for making restic. It seems like it is exactly what I need, it is lightweight, it is straightforward, it seems easy to handle.

I want to use restic to make regular backups of my nextcloud instance to a remote server I have ssh access to. I established ssh keys and I am able to login to the remote machine using key based authentication.

My setup is Ubuntu 18.04 and my restic version is 0.8.3 (it seems this is the latest for my distro).

Setting up the remote repository worked like a charm. I followed the “SFTP” section of the official docs:

restic -r sftp:restic@subdomain.mydomain.tld:/media/backup/nextcloud-backup-repo init

For the next step, I wanted to create the first snapshot, backing up a local directory to the remote machine. From the official docs, I concluded this should work:

restic -r sftp:restic@subdomain.mydomain.tld:/media/backup/nextcloud-backup-repo --verbose backup /media/nextcloud/data/

However this returns an error:

unknown command "/media/nextcloud/data/" for "restic"

I tried putting it in quotes put that doesn’t help either. What am I doing wrong?

Okay, so I got it to work now by using this syntax:

restic backup /media/nextcloud/data/ -r sftp:restic@subdomain.mydomain.tld:/media/backup/nextcloud-backup-repo

However it seems the verbose option is not available for version 0.8.3. Will I have to compile the most recent version myself or is there any way to get it via apt-get?

You might be able to use a newer restic package from a more recent Ubuntu version (just make sure to not pull in anything else) or you can get a prebuilt version from https://github.com/restic/restic/releases .

1 Like

Well, that was much easier than I thought, thank you so much!

For any future users that might encounter the same problem here’s a step by step:

  1. Find out your CPU architecture to determine which binary you need:
    lscpu

  2. Download binary from github according to architecture using wget (I’m using an odroid XU4, so my CPU has the ARM instruction set). Any directory you have write permissions to should be fine:
    wget https://github.com/restic/restic/releases/download/v0.9.6/restic_0.9.6_linux_arm.bz2

  3. Extract the downloaded binary using bzip:
    bzip2 -d restic_0.9.6_linux_arm.bz2

  4. Move and rename the binary to a directory the shell looks into to find executables. I’m using Ubuntu 18.04 so I’m putting it into /usr/local/bin (You can find all directories the shell looks into by using echo $PATH):
    mv restic_0.9.6_linux_arm /usr/local/bin/restic

  5. You should now be able to use restic:
    restic -v

If you get a permission error, you might need to add execute permissions to the binary as root
chmod 755 /usr/local/bin/restic

Note that you should not use apt-get to install future versions of restic since this was a manual install. You should use restic self-update instead.

Thanks again to MichaelEischer!

Note that you might need to install shell-completion and manual pages manually (restic generate) as they were probably removed with the package.

1 Like