borg icon indicating copy to clipboard operation
borg copied to clipboard

query quota set / use from repository

Open rugk opened this issue 8 years ago • 5 comments

Is there any way to query the quota introduced in https://github.com/borgbackup/borg/pull/2565? So that I, as a borg client/borg user, check how much size my remote repo already uses and how much space I still have left, so that I can potentially tweak my prune settings, manually delete large archives, etc.


:moneybag: there is a bounty for this

rugk avatar Jul 23 '17 22:07 rugk

should tell:

  • storage quota use (as we track it in hints)
  • storage quota set (from repo config or overridden via borg serve option)

implementation:

  • for local repos should be rather easy (but of limited application as quotas might be most frequently used by backup space providers)
  • for remote (ssh:) repos needs a new rpc call

ThomasWaldmann avatar Mar 22 '19 14:03 ThomasWaldmann

From repository.py:

    def log_storage_quota(self):
        if self.storage_quota:
            logger.info('Storage quota: %s out of %s used.',
                        format_file_size(self.storage_quota_use), format_file_size(self.storage_quota))

@rugk looks like quota available and actual use is already logged - if you are logging at INFO level.

This code is called by commit() and prepare_txn().

So, just logging at INFO level and looking in your logs seems to solve this, without introducing a new RPC api.

ThomasWaldmann avatar Apr 20 '19 18:04 ThomasWaldmann

Okay, thanks. However, at least borg info or so should show it, should not it?

Looking deep into some (info) logs cannot be a solution…

rugk avatar Apr 21 '19 12:04 rugk

As it is currently implemented, the used-quota stored in the hints file is only loaded when a transaction is started.

And why is looking into a log not a solution? :)

ThomasWaldmann avatar Apr 21 '19 13:04 ThomasWaldmann

Asked otherwise. Why should not it be displayed in borg info? It is a very useful information for the user when backing up., especially as it is critical if the space runs low. Just a simple "Usage: XX bytes out of XY bytes"?

…or, for that reason, after a backup was created with borg create.

rugk avatar Apr 21 '19 13:04 rugk

I'm thinking about implementing this. As I understand @rugk wants to add quota info to the output of info and create. Where in the output should I put it? At the top so it looks like this?

Used quota: 123MB out of 5GB
Archive name: 1
Archive fingerprint: f2718537357293f6458b9c622b15c08577c036b50e650c129c12ffdbc2206fbe
...

Archive name: 2
...

And in borg create should I add it to the --stats option? create doesn't give any output by default.

francoo98 avatar Oct 25 '22 00:10 francoo98

@ThomasWaldmann Did you read my comment?

francoo98 avatar Oct 31 '22 14:10 francoo98

The obvious place to output the quota information is borg info I'ld say.

Not a big fan from putting more and more into borg create output.

ThomasWaldmann avatar Nov 03 '22 13:11 ThomasWaldmann

Can I get this assigned?

francoo98 avatar Nov 03 '22 20:11 francoo98

@francoo98 thanks for working on this. claim the bounty!

ThomasWaldmann avatar Dec 24 '22 00:12 ThomasWaldmann

You're welcome, I'm happy to help 😁

francoo98 avatar Dec 24 '22 01:12 francoo98