Advanced --backup-dir questions

What is the problem you are having with rclone?


Consider the following scenario:

I have a local folder "TestFolder", which I want to back up on a remote (raspberry pi on the home network). I want to back it up encrypted, so I create two remotes in my rclone.conf as outlined below.

type = sftp
host = [local ip]
user = [user on rpi]

type = crypt
remote = rpi:/storage/current
filename_encryption = standard
directory_name_encryption = true

I can run the following command just fine and end up with the encrypted TestFolder on the remote.

rclone sync TestFolder rpi_crypt:TestFolder

The folder structure on the remote looks like this

- storage
  - current
    - fsdf97szhfjags (encrypted TestFolder)

Now instead of only keeping the current version of the folder, I also want to keep reverse incremental backups. That's where the --backup-dir command comes into play.

I want to end up with this:

- storage
  - current
    - fsdf97szhfjags (encrypted TestFolder)
  - old
    - 2023-02-14
      - fsdf97szhfjags (encrypted TestFolder, with old files)
    - 2023-02-13
      - fsdf97szhfjags (encrypted TestFolder, with old files)
    - 2023-02-12
      - fsdf97szhfjags (encrypted TestFolder, with old files)

I've tried to edit the rpi_crypt remote to point to rpi/storage and run the following command. This will unfortunately also encrypt the current, old and date folders, which I want to keep in readable form.

rclone sync --backup-dir=rpi_crypt:old/$date TestFolder rpi_crypt:current/TestFolder

I've also tried to have two crypt remotes, which point to rpi/storage/current and rpi/storage/old/$date respectively. However, the --backup-dir command won't allow a different remote than the sync target, even though they are on the same machine, with same credentials and same encryption.

The only way I currently see to achieve this is by

  • running rclone sync with a backup dir inside current, like current/temp

then running a bunch of commands via ssh to move the old files

  • ssh rpi mkdir storage/old/$date
  • ssh rpi mv storage/current/EncryptedTemp/** /storage/old/$date
  • ssh rpi rm -r storage/current/EncryptedTemp

Is there a way to achieve this with just rclone, without temporary folders and follow up commands?


Edit: Hmm, maybe this is more of a question about not encrypting some top level folders than it is about --backup-dir?

Run the command 'rclone version' and share the full output of the command.

rclone v1.61.1

  • os/version: debian 11.6 (64 bit)
  • os/kernel: 5.10.0-21-amd64 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.19.4
  • go/linking: static
  • go/tags: none

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.