10000 "copy" does not work · Issue #469 · creativeprojects/resticprofile · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

"copy" does not work #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hgraeber opened this issue Mar 16, 2025 · 2 comments
Open

"copy" does not work #469

hgraeber opened this issue Mar 16, 2025 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@hgraeber
Copy link
Contributor

I want to make a two level backup. First level: Make a backup from one or more machines onto an internal backup server. Second level: Make a backup of the backup onto a external disk (or to a cloud repository). For the second level backup I want to run resticprofile with a copy command on the backup server. But the copy command doesn't work as intended.

To make my test easier I have both profiles in on configuration file (data to backup, the first level repo and the second level repo are in one folder). In reality I have to configurations, one on the machines to backup with profile default and one on the backup server with profile secondary.

version: 2

profiles:
  default:
    repository: "repo"
    password-file: repo-secret

    init:

    backup:
      source: "data"
      schedule:
        at: "5:00"

    retention:
      after-backup: true
      keep-within-daily: 7d
      keep-within-weekly: 1m

  secondary:
    repository: "secondary"
    password-file: secondary-secret

    init:
      copy-chunker-params: true
      from-repository: "repo"
      from-password: repo-secret

    copy:
      from-repository: "repo"
      from-password: repo-secret

    forget:
      keep-within-daily: 7d
      keep-within-weekly: 1m

For initialization I run

resticprofile init
resticprofile secondary.init

The backup is run per schedule:

resticprofile backup

And from time to time, normally onto a disk, her into the local secondary repo:

resticprofile secondary.copy

The last step fails (output a little bit edited):

2025/03/16 19:08:29 resticprofile 0.29.1 compiled with go1.24.1
2025/03/16 19:08:29 using configuration file: profiles.yaml
2025/03/16 19:08:29 loading: profiles.yaml
2025/03/16 19:08:29 memory available: 24514MB
2025/03/16 19:08:29 using restic 0.17.3
2025/03/16 19:08:29 profile 'secondary': starting 'copy'
2025/03/16 19:08:29 command environment:
...
2025/03/16 19:08:29 starting command: /usr/bin/restic copy --from-password-file=secondary-secret --from-repo=secondary --verbose=1
repository 02f5638e opened (version 2, compression level auto)
Fatal: Please specify repository location (-r or --repository-file)
2025/03/16 19:08:30 copy on profile 'secondary': exit status 1

I suspect the cause of this is the "Special case" described in "resticprofile > Configuration file > Copy command". There it is described that the "from-" prefix can be omitted. But the "Special Case" somehow reverses "source" and destination, to. restic usually uses --repository and friends for the destination for both the backup and the copy command. resticprofile breaks with this, which isn't a good idea. I there is good reason for this reversal, this shall be done with another special restic command (say reverse-copy) and leave the copy command compatible to the usual restic behavior.

BTW: it would be nice if we can have the retention section work with copy, too. But that's another issue...

@creativeprojects
Copy link
Owner

Maybe it's a bit confusing in the documentation 🤔 Your configuration is indeed reversed.

The copy section indicates the target of the copy, not where it's copied from.

Your configuration should look like this:

version: 2

profiles:
  default:
    repository: "repo"
    password-file: repo-secret

    init:

    backup:
      source: "data"
      schedule:
        at: "5:00"

    retention:
      after-backup: true
      keep-within-daily: 7d
      keep-within-weekly: 1m

    copy:
      initialize-copy-chunker-params: true
      repository: "secondary"
      password: secondary-secret

  secondary:
    repository: "secondary"
    password-file: secondary-secret

    forget:
      keep-within-daily: 7d
      keep-within-weekly: 1m

@hgraeber
Copy link
Contributor Author

As I mentioned the default profile is meant to be used on the machine to backup to my backup server and the secondary profile on the backup server to make to copy to the disk. I only merged both into one configuration file for my tests. So the configuration on the backup machine can only work if i use two different profiles for copy and forget. This is not very intuitive:

version: 2

profiles:
  secondary1:
    repository: "repo"
    password-file: repo-secret

    copy:
      repository: "secondary"
      password: secondary-secret

  secondary2:
    repository: "secondary"
    password-file: secondary-secret

    forget:
      keep-within-daily: 7d
      keep-within-weekly: 1m

I think implementing copy different to restics copy is a very bad idea. I prefer to make it behave the same in both programs. I think you have some reason for your change. So you can add a reverse copy function named copy-to instead. Additionally, it would be nice to have after-copy and before-copy entries in the retention-section.

@creativeprojects creativeprojects added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants
0