Skip to content

borg check --archives-only --last-n-seconds #7062

Description

@magma1447

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

Feature request

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

1.2.2

Operating system (distribution) and version.

Debian 10 / 11

Hardware / network configuration, and filesystems used.

Linux software raid + mergerfs + ext4

How much data is handled by borg?

Approximately 10 TB

Full borg commandline that lead to the problem (leave away excludes and passwords)

borg check --archives-only --last-n-seconds 864000

Describe the problem you're observing.

I have a borg repository to which more than one server sends backups. These servers are VM (kvm/libvirt) servers which handles multiple virtual machines. These are snapshoted and the images are sent to borg.

At times I want to run a check on the repository to make sure that it works as intended. I then run a borg check --repository-only, and want to follow that with a borg check --archives-only, which should include all recent archives. The problem is that borg only supports "last n" backups, and I do not know how many that is.

I would be grateful if a --last-n-seconds (name not important) was implemented, that could be used to run a check on all archives created the last week for example.

My current workaround is to first make a list, send that to jq which does some magic and returns to me the number of archives that are new enough. Example:
borg list --json <repository> |jq '[ .archives[] | select(.start |split(".")[0] |strptime("%Y-%m-%dT%H:%M:%S") |mktime > now - 10*86400) ] |length'

Then I run borg check --archives-only --last <number from above>.

My workaround is a bit cumbersome and introduces a dependency on jq. There is also the case where another server could start a backup between the list and check commands. That could probably be solved by borg with-lock, but it makes it even more complex. Letting borg handle it itself sounds like a better looking solution.

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

Yes, it's a feature request. :)

Include any warning/errors/backtraces from the system logs

No logs neccessary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions